thoughtbot/cocaine — pull request #12 by bdurand (2012-02-29 02:40:06+00:00)
Title: Add hooks to use posix-spawn gem if available

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.