Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

On my PC:

  time node -e "console.log('a')" # 0.377 total
  time ruby -e "p 'aaa'" # 0.084 total
  time python3 -c "print('a')" # 0.020 total
  time elixir -e "IO.puts 'a'" # 0.117 total
  time _build/prod/rel/bakeware/simple_script Hi # 0.205 total without zstd, 0.212 with
Another question is which language loads modules the fastest (afaik Ruby is kind of slow when it comes to `require`).


> Another question is which language loads modules the fastest (afaik Ruby is kind of slow when it comes to `require`).

I think both Python and Ruby loosely follow a similar model. The difference is that IIRC Python caches bytecode files, while Ruby compiles them from scratch every time. Not sure how big of a performance impact that has, especially for simple cases like this.

And just to toot my own horn, using Inko (https://inko-lang.org/), I get:

    inko /tmp/test.inko # 0.470 total
Note that this invokes the horribly slow Ruby compiler currently in use. If you invoke the VM directly on the compiled bytecode, it only takes about 10 milliseconds to run. Using the `master` branch:

    vm/target/release/ivm /home/yorickpeterse/.cache/inko/bytecode/release/43/38021ddc9a3449ace13288a2fac894d1d3e2aaa.ibi # 0.008.8 total
In this case all modules (including the standard library) are included in the bytecode file, meaning no disk IO is necessary, and modules can be parsed in parallel.

This is something dynamic languages like Ruby and Python can't do, as loading modules is something that can be done anywhere at any time, so you have to process them one by one.


Perl's startup time is pretty good.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: