4 ms·
Startup time is another. For example: $ elixir test.exs hello, world! $ hyperfine "elixir test.exs" Benchmark 1: elixir test.exs Time (m
by square_usual 3y ago
Startup time is another. For example:
$ elixir test.exs
hello, world!
$ hyperfine "elixir test.exs"
Benchmark 1: elixir test.exs
Time (mean ± σ): 471.1 ms ± 2.6 ms [User: 187.4 ms, System: 83.1 ms]
Range (min … max): 467.1 ms … 475.6 ms 10 runs
Compared to:
$ ruby test.rb
hello, world!
$ hyperfine "ruby test.rb"
Benchmark 1: ruby test.rb
Time (mean ± σ): 36.3 ms ± 2.6 ms [User: 26.0 ms, System: 8.4 ms]
Range (min … max): 34.5 ms … 53.6 ms 53 runs
In practice, I've been able to get the ruby startup time to as low as 6ms - this is what I use for scripts running as keyboard macros, for example. I cannot practically use elixir for that.
- hosh 3y agoHuh, interesting. I bet for keyboard macros, it would work better by invoking a call to something that is already running to reduce startup time. Kinda like the emacs server. BEAM should still be able to compile new code on the fly, for one-off scripts
- square_usual 3y ago> keyboard macros [...] would work better by invoking a call to something that is already running to reduce startup time Maybe, but that comes with two disadvantages: - I would have to re-architect my scripts to work like that, and run a server with uncertain memory costs perpetually; and - I would have to use something with faster start time to run the call on my keyboard macros, e.g. bash, which would mean writing bash instead of elixir/ruby and/or being clever.
- barkerja 3y agoUsing escript, I am able to almost halve the startup time. But it's still ~4x slower than ruby. hyperfine "./derp" Benchmark 1: ./derp Time (mean ± σ): 241.0 ms ± 7.4 ms [User: 146.9 ms, System: 170.8 ms] Range (min … max): 235.1 ms … 261.7 ms 11 runs