languages icon indicating copy to clipboard operation
languages copied to clipboard

Add cython implementation

Open poudro opened this issue 1 year ago • 2 comments

Thanks for the fun repo :)

This is pretty much cheating as this compiles down to C equivalent, but fun nonetheless

languages/loops/cython$ hyperfine -i --shell=none --runs 3 --warmup 2 "./code 40"
Benchmark 1: ./code 40
  Time (mean ± σ):     649.8 ms ±   0.2 ms    [User: 642.9 ms, System: 5.9 ms]
  Range (min … max):   649.6 ms … 650.0 ms    3 runs

As a short explanation, Cython is a python library that allows to write python code, or very similar, and convert it to C for efficiency.

poudro avatar Dec 07 '24 13:12 poudro

Interesting! Wanna add the fib test case as well?

bddicken avatar Dec 09 '24 03:12 bddicken

Just added the fib test

languages/fibonacci/cython$ hyperfine -i --shell=none --runs 3 --warmup 2 "./code 40"
Benchmark 1: ./code 40
  Time (mean ± σ):     852.5 ms ±  10.5 ms    [User: 837.9 ms, System: 8.3 ms]
  Range (min … max):   841.9 ms … 863.0 ms    3 runs

thanks for your interest :)

poudro avatar Dec 09 '24 08:12 poudro