bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

idea: statically-linked "busy-bash"


From: Richard Neill
Subject: idea: statically-linked "busy-bash"
Date: Thu, 09 Apr 2009 07:10:57 +0100
User-agent: Thunderbird 2.0.0.19 (X11/20090114)

Dear All,

Here's an idea that occurred to me. I'm not sure whether it's a great idea, or a really really stupid one, so please feel free to shoot it down. Anyway, there are an awful lot of shell scripts where a huge number of the coreutils get repeatedly called in separate processes. This call-overhead makes the scripts run noticeably slower.

What I'm suggesting is to experimentally build a version of bash which has mv/cp/ls/stat/grep/.... all built in. This would be a rather bigger binary, (similar to busybox), but might allow much much faster execution of long scripts.

A very quick experiment shows that this might be worthwhile:

date;
for ((i=0;i<1000000;i++)); do echo -n ""; done;
date;
for ((i=0;i<10000;i++)); do /bin/echo -n ""; done;
date

Prints:
Thu Apr  9 07:05:19 BST 2009
Thu Apr  9 07:05:30 BST 2009
Thu Apr  9 07:05:47 BST 2009


In other words, 1E6 invocations of the builtin takes about 11
seconds, while 1E4 invocations of the standalone binary
takes 17 seconds. The builtin echo is therefore about
150 times faster.

What do you think?

Richard









reply via email to

[Prev in Thread] Current Thread [Next in Thread]