3 ms·
> My biggest criticism of Elixir has been the difficulty of writing quick scripts Curious what you find to be the biggest pain point(s) here. Is it runtime con
by barkerja 3y ago
> My biggest criticism of Elixir has been the difficulty of writing quick scripts
Curious what you find to be the biggest pain point(s) here. Is it runtime containment? Library access? Etc.
- monsieurbanana 3y agoIs the size of the erlang vm one such point? I think I remember reading it's about 500mb, and you won't find it installed by default in many systems.
- square_usual 3y agoStartup 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
- bongobingo1 3y agoMost of my phoenix apps sit under or around 100mb resident, and they load a fair bout more than a script probably would.
- nelsonic 3y agoNot even close. A Nerves (iOT) package with Linux Kernel and Erlang/OTP VM and our App code comes in at 21Mb. See: https://nerves-project.org/ https://nerves-project.org/