alias Exile.ProcessNif
Benchee.run(
%{
"exile" => fn ->
{:ok, ctx} = ProcessNif.execute(['/bin/cat'], [], '', 0)
ctx
end,
"port" => fn ->
Port.open({:spawn_executable, '/bin/cat'}, [])
end
},
after_each: fn
t when is_port(t) ->
Port.close(t)
ctx ->
ProcessNif.sys_close(ctx, 0)
ProcessNif.sys_close(ctx, 1)
:timer.sleep(5)
{:ok, {:exit, 0}} = ProcessNif.sys_wait(ctx)
end,
time: 5
)
Operating System: macOS
CPU Information: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Number of Available Cores: 12
Available memory: 16 GB
Elixir 1.9.4
Erlang 22.1.1
Benchmark suite executing with the following configuration:
warmup: 2 s
time: 5 s
memory time: 0 ns
parallel: 1
inputs: none specified
Estimated total run time: 14 s
Benchmarking exile...
Benchmarking port...
Name ips average deviation median 99th %
port 3.26 K 306.75 μs ±13.08% 304.98 μs 411.98 μs
exile 1.09 K 917.65 μs ±19.95% 898.98 μs 1473.98 μs
Comparison:
port 3.26 K
exile 1.09 K - 2.99x slower +610.90 μs
Extended statistics:
Name minimum maximum sample size mode
port 221.98 μs 612.98 μs 15.51 K 312.98 μs, 306.98 μs
exile 521.98 μs 1570.98 μs 579 895.98 μs