-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
I noticed that posix-spawn's implementation of the back-tick operator is significantly slower than the built-in implementation of MRI ruby 2.2.2 on both Linux and Mac OS X:
require "benchmark"
require "posix/spawn"
n = 10_000
cmd = "/bin/echo".freeze
Benchmark.bm do |x|
x.report("Kernel.\`") { n.times { Kernel.` cmd } }
x.report("POSIX::Spawn.\`") { n.times { POSIX::Spawn.` cmd } }
endResult on Mac OS X 10.11 Beta 6, Darwin 15.0.0 x86_64, ruby 2.2.2p133, posix-spawn 0.3.11:
user system total real
Kernel.` 0.800000 5.470000 42.220000 ( 42.443894)
POSIX::Spawn.` 14.350000 2.440000 100.060000 (102.485969)
Result on Ubuntu Server 14.04.3 LTS, Linux 3.13.0 x86_64, ruby 2.2.2p95, posix-spawn 0.3.11:
user system total real
Kernel.` 1.080000 0.810000 18.140000 ( 17.168791)
POSIX::Spawn.` 1.440000 1.030000 34.150000 ( 32.650234)
Metadata
Metadata
Assignees
Labels
No labels