Skip to content

Instantly share code, notes, and snippets.

@acook
Last active December 23, 2021 05:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acook/6420543 to your computer and use it in GitHub Desktop.
Save acook/6420543 to your computer and use it in GitHub Desktop.
Startup speeds of various interpreters, source: https://github.com/acook/impel/blob/master/spec/benchmark_spec.rb#L44

What is this?

This benchmark establishes baseline the cost-of-doing-business for using a given interpreted language. It gauges the initialization/teardown overhead before/after the interpreter can actually do any work. Each program is the nearest equivalent of a single exit(0) command as possible. This is not a general-purpose benchmark, but it's interesting to see how different interpreters behave. The below tests were all run on the same CPU running the noop programs for 200 iterations.

Why?

The original impetus was for a project called impel which was going to be executed in the $PS1, $PROMPT_COMMAND, precmd, or equivalent where I wanted to avoid adding latency to the command prompt but was ambivalent about the language it was written in. There are certainly other concerns to be had beyond this overhead, it's just one of many things to take into consideration.

2nd Table

The rebol_reference benchmarks are provided separately since they're a universe unto themselves. It also includes a "control" in the form of a C program compiled with Clang.

USER SYSTEM TOTAL REAL
-- luajit : 0.030000 0.240000 1.150000 ( 1.209029)
-- lua : 0.040000 0.260000 1.170000 ( 1.217026)
-- bash : 0.040000 0.240000 1.310000 ( 1.332718)
-- bash_socket : 0.040000 0.260000 1.360000 ( 1.372836)
-- perl : 0.040000 0.300000 1.850000 ( 2.036270)
-- blacklight : 0.040000 0.270000 1.480000 ( 2.161735)
-- rebol3 : 0.040000 0.270000 2.400000 ( 2.574477)
-- python : 0.040000 0.270000 4.500000 ( 4.785574)
-- node : 0.040000 0.270000 9.290000 ( 9.567964)
-- io : 0.050000 0.280000 9.800000 ( 9.985156)
-- ruby : 0.050000 0.330000 39.410000 ( 40.546968)
-- erlang : 0.040000 0.220000 28.510000 ( 41.995474)
-- elixir : 0.050000 0.260000 53.130000 ( 45.518337)
USER SYSTEM TOTAL REAL
-- clang : 0.040000 0.220000 0.700000 ( 0.725175)
-- rebol3 : 0.040000 0.330000 2.500000 ( 2.628114)
-- red : 0.040000 0.260000 4.410000 ( 4.469486)
-- ren_c -O2 : 0.050000 0.360000 6.110000 ( 6.672150) - edited makefile to optimize
-- ren_c : 0.050000 0.360000 11.260000 ( 11.576475) - default build according to readme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment