Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

Benchmark Languages

This repository provides small CLI programs in multiple languages that perform an identical, moderately complex workload while measuring both CPU cycles and wall-clock time consumed. The programs manipulate integers and strings in a loop so the compiler cannot optimise the entire computation away. They are intended for comparing performance across languages on Linux/WSL.

Languages Included

  • C
  • C++
  • Rust
  • Go
  • Python
  • JavaScript (Node.js)
  • Java

Installing Compilers/Interpreters

On Ubuntu you can install the required tools with:

sudo apt-get update
sudo apt-get install build-essential golang rustc cargo python3 nodejs default-jdk

Build and Run

C

gcc -O2 c/time_test.c -o c/time_test
./c/time_test 1000000

C++

g++ -O2 cpp/time_test.cpp -o cpp/time_test
./cpp/time_test 1000000

Rust

cd rust
cargo build --release
./target/release/rust_app 1000000

Go

go build -o go/time_test go/main.go
./go/time_test 1000000

Python

python3 python/main.py 1000000

Node.js

node node/main.js 1000000

Java

javac java/TimeTest.java
java -cp java TimeTest 1000000

You can change the numeric argument to adjust the workload for your benchmark.

Run all benchmarks

The helper script run_benchmarks.py builds and runs each implementation in sequence. Provide the desired iteration count as an argument:

python3 run_benchmarks.py 1000000

The script prints the output from each language and a table summarizing the cycle counts and execution times.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages