logoalt Hacker News

smartmicyesterday at 1:58 PM1 replyview on HN

Yes, that is also my feeling. But comparing an interpreted language with a compiled one is not really fair.

Here is my quick benchmark. I refrain from using Python for most scripting/prototyping task but really like Janet [0] - here is a comparison for printing the current time in Unix epoch:

    $ hyperfine --shell=none --warmup 2  "python3 -c 'import time;print(time.time())'" "janet -e '(print (os/time))'"
  Benchmark 1: python3 -c 'import time;print(time.time())'
  Time (mean ± σ):      22.3 ms ±   0.9 ms    [User: 12.1 ms, System: 4.2 ms]
  Range (min … max):    20.8 ms …  25.6 ms    126 runs

  Benchmark 2: janet -e '(print (os/time))'
  Time (mean ± σ):       3.9 ms ±   0.2 ms    [User: 1.2 ms, System: 0.5 ms]
  Range (min … max):     3.6 ms …   5.1 ms    699 runs

  Summary
  'janet -e '(print (os/time))'' ran
    5.75 ± 0.39 times faster than 'python3 -c 'import time;print(time.time())''
[0]: https://janet-lang.org/

Replies

curiousgalyesterday at 5:09 PM

Well python is also compiled technically.