(Slightly) Improve Python and Cython benchmarks #25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
andpypy.001.binary
: exactly the same logic as thepython
andpypy
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 fromc.001
in Cython syntax, it runs as fast asc.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):
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!