[patch] coreutils/printf.c
Cristian Ionescu-Idbohrn
cristian.ionescu-idbohrn at axis.com
Thu May 29 21:53:03 UTC 2008
Chops a long line and removes an overfluous cast.
I'd like to optionaly be able to have printf builtin into ash.
Playing with it right now. On the positive side, my poor attempt
shows that this command line:
# ./busybox ash -c 'for D in $(date +%s);do for N in $(seq 1 100000);do \
printf "%d. %d\n" $N 23 >/dev/null;done; \
echo "elapsed $(($(date +%s) - $D))s";done'
take 96s to complete on my box with unmodified bb-svn, and 2-3s with my
first go at an ash bultin prinf. That's 32-48 times faster.
On the negative side, the above command line outputs all 100000 lines to
stdout, even if I redirect to /dev/null, but it doesn't do that if I run
it like this:
# ./busybox ash
$ for D in $(date +%s);do for N in $(seq 1 100000);do \
printf "%d. %d\n" $N 23 >/dev/null;done; \
echo "elapsed $(($(date +%s) - $D))s";done
$ ^D
Obviously I'm missing something, but I can't figure it out right now :(
2nd attachment is my simple ash-printf-builtin patch attempt. Seems to
cost some 6 bytes. I'd be glad to hear some comments.
Cheers,
--
Cristian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: printf.c.patch
Type: text/x-diff
Size: 618 bytes
Desc:
Url : http://lists.busybox.net/pipermail/busybox/attachments/20080529/2887a175/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bb-ash-printf-builtin.patch
Type: text/x-diff
Size: 3872 bytes
Desc:
Url : http://lists.busybox.net/pipermail/busybox/attachments/20080529/2887a175/attachment-0001.bin
More information about the busybox
mailing list