pddshk / stl-benchmark

STL benchmark comparing C++ and Julia ⏱

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

STL Benchmark

STL benchmark comparing C++ and Julia ⏱

For more information: STL Benchmark Comparison: C++ vs. Julia.

Getting Started

git clone --recurse-submodules git@github.com:pddshk/stl-benchmark.git

NB! to run this you need to place #include <limits> into cpp/benchmark/src/benchmark_register.h

From the cpp directory:

export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j
./stl_benchmark

Sample output

Running ./stl_benchmark
Run on (12 X 4500 MHz CPU s)
CPU Caches:
  L1 Data 32K (x6)
  L1 Instruction 32K (x6)
  L2 Unified 256K (x6)
  L3 Unified 12288K (x1)
--------------------------------------------------
Benchmark           Time           CPU Iterations
--------------------------------------------------
ParseStl       237056 ns     236744 ns       2912

From the julia directory:

$ julia -O3
julia> ]
(v1.6) pkg> add BenchmarkTools
julia> using BenchmarkTools
julia> include("stl.jl")
julia> @btime STL.parse("nist.stl")
  110.646 μs (14 allocations: 347.30 KiB)

From the python directory:

$ python benchmark.py
13513.513993530069 μs μs

Note: Python 3.7.0 is required.

Results

Language Time
C++ 237.056 μs
Julia 110.646 μs
Python 13513.5 μs

About

STL benchmark comparing C++ and Julia ⏱

License:MIT License


Languages

Language:Julia 37.0%Language:C++ 29.6%Language:Python 25.5%Language:CMake 7.9%