On 06/01/08 17:34 +0800, Dasn wrote:
>$ for i in * ; do env printf "%s\0" $i; done
This has a performance issue.
On obsd with ksh (without builtin printf):
$ ls -1 | wc -l
10003
$ f() for i in *; do printf "%s\0" $i; done;
$ time f > f.txt
2m1.07s real 0m2.92s user 0m15.17s system
# Note: Too many matches will cause "Argument list too long" error
$ time printf "%s\0" * > printf.txt
0m0.10s real 0m0.07s user 0m0.03s system
# A similar alternative, not accurate.
$ time find . -name '*' -print0 > find.txt
0m0.12s real 0m0.07s user 0m0.04s system
--
Dasn
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---