Python basically using C types and GMP to write C in Python...
Python basically using C types and GMP to write C in Python...
It’s not really what you’d expect for a site called computer language benchmarks game. Each example just calls out to a very fast c library (pcre2) to perform the heavy lifting regardless of which language is being “benchmarked”.
Seems a pretty pointless site.
The other examples have similar nonsense.
> "... a pretty solid study on the boredom of performance-oriented software engineers grouped by programming language."
I think that's probably the best way to describe it.
Edit to answer yours: There may be less Python programmers that are bored, or less performance-oriented Python programmers.
No.
https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
Your python 3 one isnt the fastest python 3 solution, it’s this one which uses pcre2
The slower program is an example from that website of a regex program which does not " just calls out to a very fast c library (pcre2)…".
from re import sub, findall
That's where pcre2 is called (or a finely tuned regex c lib)https://docs.python.org/3/library/re.html
pcre2 is not —
https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
Here's some of a comment from _operator.c
"This module exports a set of functions implemented in C corresponding\n\ to the intrinsic operators of Python. For example, operator.add(x, y)\n\ is equivalent to the expression x+y."
Why wouldn't you expect that CPython regex would "ultimately" be written in C?
Did you? :-)
That Node pidigits program also uses GMP.
Besides those 2, did you notice other JS programs not 50x faster than the corresponding Python programs ?
But everyone knows it is significantly faster than Python. Probably at least a few times for pure JS vs. pure Python programs. Not that it matters, Python is basically glue to run mostly C and C++ programs.