vak: (Default)
Serge Vakulenko ([personal profile] vak) wrote2024-11-26 04:03 pm

Бенчмарки для сравнения языков программирования

github.com/bddicken/languages

На настоящий момент сравниваются языки Kotlin, C, Go, Rust, Node, Bun, Deno, PyPy, Java, Ruby, PHP, R, Python, Dart. Жаль нету Swift и Perl.

Два теста:
  • loops
  • fibonacci
Предлагается добавлять новые тесты и языки.

[personal profile] sassa_nf 2024-11-27 10:00 pm (UTC)(link)
OpenJDK 11
Benchmark           (size)  Mode  Cnt       Score      Error  Units
Fibo.FiboRecursive      40  avgt   25  922753.617 ± 2747.036  us/op

0.9s, basically.


OpenJDK 17
Benchmark           (size)  Mode  Cnt        Score      Error  Units
Fibo.FiboRecursive      40  avgt   25  1032010.482 ± 8309.430  us/op

1s, basically.


OracleJDK 23
Benchmark           (size)  Mode  Cnt        Score      Error  Units
Fibo.FiboRecursive      40  avgt   25  1082715.628 ± 6358.441  us/op


I would expect your numbers to be dominated by JVM startup. Are you on SSD?

At the same time, fibonacci using GCC is 0.38s, and using clang is 0.56s, so it's not just a slow computer.
Edited 2024-11-27 22:02 (UTC)

[personal profile] sassa_nf 2024-11-28 09:50 am (UTC)(link)
Actually, no, the effect is coming from other parameters of the system, not startup specifically.