Closed bdurand closed 12 years ago
I've added another commit to add some tests.
In order to do this, I did have to change the code in the CommandLine#run method to call the ` method on the CommandLine instance instead of on the class. I can't think of any reason it needed to be called on the class in the first place so this should be fine.
All the specs still pass and my performance test still shows the same numbers.
Any chance we can get a gem release with this code in it? This pull request from paperclip which is now in production could use it.
This commit add a hook to use the posix-spawn gem if it is available (https://github.com/rtomayko/posix-spawn). This gem exposes a far more efficient method of spawing other processes without copying the entire ruby heap.
I've run a simple test calling 'echo hello' from a ruby process where the heap is filled with 5 million strings.
On REE 1.8.7 on Linux the echo call takes an average of 40.6ms without posix-spawn and 0.5ms with it.
On Ruby 1.9.2 on Linux the echo call takes an average of 18.4ms without posix-spawn and 0.4ms with it.
The difference is most pronounced on Linux and much less so on MacOSX.