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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Slightly) Improve Python and Cython benchmarks #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

althonos
Copy link

@althonos althonos commented Apr 16, 2021

Hi there !

It's a very nice project you have, I'm usually too lazy to setup a proper environment for benchmarking but with yours ready I could just pop in some extra benches without trouble.

As a Pythonista, I am aware of Python's abysmal performances regarding I/O, but I was still a bit sad to see it so low in the list. I also looked at the Cython solution and saw that it was clearly not using the whole power of Cython, so here's what I added:

  • python.001.binary and pypy.001.binary: exactly the same logic as the python and pypy benches, except that the files are opened in binary mode, which should save a bit of time decoding. It doesn't seem to make any difference with PyPy, but it does improve CPython a bit.
  • cython.001.fopen: a Cython version that actually uses the code from c.001 in Cython syntax, it runs as fast as c.001.

I didn't bench against everything else because I was missing some of the other languages compilers, but here is what I get on my machine (idle Intel NUC with i7-10710U CPU @ 1.10GHz, no particular BIOS setting):

Language Time (s) Compiler or interpreter version
rust.004.simd 0.271 rustc 1.46.0-nightly (346aec9b0 2020-07-11)
rust.003.vectorized 0.28 rustc 1.46.0-nightly (346aec9b0 2020-07-11)
rust.002.bitshift 0.396 rustc 1.46.0-nightly (346aec9b0 2020-07-11)
rust.001 0.471 rustc 1.46.0-nightly (346aec9b0 2020-07-11)
c.001 0.596 gcc (GCC) 10.2.0
cython.001.fopen 0.603 Cython version 0.29.21
cpp.001 0.623 g++ (GCC) 10.2.0
d 0.653 LDC - the LLVM D compiler (1.25.1): based on DMD v2.095.1
c 0.718 gcc (GCC) 10.2.0
go.001.unroll 0.796 go version go1.16.3 linux/amd64
rust 0.871 rustc 1.46.0-nightly (346aec9b0 2020-07-11)
go 0.972 go version go1.16.3 linux/amd64
c.003.ril 0.981 gcc (GCC) 10.2.0
crystal.002.peek 0.998 Crystal 1.0.0 (2021-03-29) LLVM: 10.0.1 Default
cpp 1.265 g++ (GCC) 10.2.0
pypy.001.binary 1.342 Python 2.7.18 (63df5ef41012b07fa6f9eaba93f05de0eb540f88, Apr 11 2021, 17:01:13) [PyPy 7.3.4 with GCC 10.2.0]
pypy 1.342 Python 2.7.18 (63df5ef41012b07fa6f9eaba93f05de0eb540f88, Apr 11 2021, 17:01:13) [PyPy 7.3.4 with GCC 10.2.0]
ada 1.942 GNAT 10.2.0
crystal.001.csp 2.527 Crystal 1.0.0 (2021-03-29) LLVM: 10.0.1 Default
crystal 2.581 Crystal 1.0.0 (2021-03-29) LLVM: 10.0.1 Default
perl 2.768 This is perl 5, version 32, subversion 1 (v5.32.1) built for x86_64-linux-thread-multi
fpc 3.156 Free Pascal Compiler version 3.2.0 [2021/03/04] for x86_64
cython 3.3 Cython version 0.29.21
python.001.binary 4.073 Python 3.9.3
python 4.421 Python 3.9.3

I'll see if i can find other solutions with Python that make it look a little better, but I don't have any high hopes 馃槄

Cheers!

@althonos althonos changed the title Improve Python and Cython benchmarks (Slightly) Improve Python and Cython benchmarks Apr 16, 2021
@samuell
Copy link
Owner

samuell commented Feb 5, 2022

Cool, thanks @althonos ! Sorry, have been too buried in work for a long time, to properly maintain the repo... having a look soon!

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.

None yet

2 participants