#10879 NORM Opportu: busybox rm not as quick as coreutils
Zarro Boogs per Child
bugtracker at laptop.org
Tue May 17 14:05:12 EDT 2011
#10879: busybox rm not as quick as coreutils
---------------------------------+------------------------------------------
Reporter: dsd | Owner: dsd
Type: defect | Status: new
Priority: normal | Milestone: Opportunity
Component: initramfs | Version: not specified
Resolution: | Keywords:
Next_action: never set | Verified: 0
Deployment_affected: | Blockedby:
Blocking: |
---------------------------------+------------------------------------------
Comment(by pgf):
i was curious, so i did some timing and stracing on a server. i see a
similar performance ratio between /bin/rm and busybox rm as reported
above.
busybox rm seems to traverse the tree from the parent, using string
concatenation to form pathnames. this results in
{{{
unlink("s/contrib/doc/shpproj.txt")
}}}
coreutils rm seems to open subdirectories directly (using openat()), and
performs the unlinks using "unlinkat()". this avoids both string
manipulation in the command, and repeated duplicate path parsing in the
kernel. i.e., the above unlink looks like this in coreutils:
{{{
unlinkat(3, "shpproj.txt", 0)
}}}
where fd 3 came from an openat() of the "doc" directory.
(i did the timings with a git checkout of busybox 1.15.1. the timings
were the same as git HEAD,
which seems to be >= 1.18.4. the stracing was done with HEAD.)
--
Ticket URL: <http://dev.laptop.org/ticket/10879#comment:1>
One Laptop Per Child <http://laptop.org/>
OLPC bug tracking system
More information about the Bugs
mailing list