Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • fork() is pretty inexpensive (depending on OS), but doing it 10000 will have a performance impact. Commented May 3, 2014 at 4:51
  • 5
    If you worry about performance, the first thing to do would be to avoid bash. Your code is zsh syntax now also supported by bash and ksh93. You'll notice bash is 2 to 3 times as slow as those. Commented May 3, 2014 at 7:30
  • Very true @StephaneChazelas, zsh runs these scripts with nearly equal speed in at least half the time it takes bash to run them. Commented May 4, 2014 at 1:16