less Idle time with busybox ash as bash vs bash

Michael Conrad mconrad at intellitree.com
Fri Sep 7 16:41:19 UTC 2018


Busybox utilities are written in whatever way uses the fewest bytes.  
Most standard utilities are optimized for speed.  Sometimes the reduced 
footprint of busybox can offset the lack of speed optimization because 
it can remain in disk cache or processor cache.  And sometimes not.

If your bash script does a lot of script logic (i.e. more of an 
application rather than just sequence of commands), then it would be 
reasonable to see a dip in performance.  If you do mostly just call 
other utilities, then you should make sure that you have PREFER_APPLETS 
enabled and that you're actually getting the benefit of avoiding 
exec().  Maybe, try running strace on each of bash and ash-as-bash and 
count the number of execve calls.  Then you'll have a decent idea of how 
the bash builtins stack up to the busybox PREFER_APPLETS overall.

On 9/6/2018 6:54 PM, James Hanley wrote:
> To be clear - when we run the same script under bash vs busybox ash as bash - bash yields 10% more idle time to the system. I assumed that the fork/exec of all the underlying utilities (test etc) compared to the vfork or function calls in busybox would yield better results (not worse) then bash.
>
> Is this expected behavior?
>
> -Jim
>
>> On Aug 31, 2018, at 2:06 PM, James Hanley <jhanley at dgtlrift.com> wrote:
>>
>> We had some bash scripts that we converted to use busybox ash as bash
>> (removed any array constructs) and when comparing the two scripts - it
>> seems that running them under busybox yields less idle time compared
>> to bash.
>>
>> I was expecting that busybox would (itself) take up more time simply
>> because of vfork, but yield more CPU time overall since there would be
>> less overhead as a number of the applets would not fork&exec.
>>
>> Is this expected behavior that busybox overall yields less idle time?
>> -Jim
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox




More information about the busybox mailing list