Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cython implementation #222

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add cython implementation #222

wants to merge 2 commits into from

Conversation

poudro
Copy link

@poudro poudro commented Dec 7, 2024

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.

@bddicken
Copy link
Owner

bddicken commented Dec 9, 2024

Interesting! Wanna add the fib test case as well?

@poudro
Copy link
Author

poudro commented Dec 9, 2024

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 :)

@miraculixx miraculixx mentioned this pull request Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants