It shows that Python can be fast enough if you leave the heavy computational parts to libraries written in other languages. Which is interesting, but doesn't say much about the speed of Python itself.
It shows that Python can be fast enough if you leave the heavy computational parts to libraries written in other languages. Which is interesting, but doesn't say much about the speed of Python itself.
Also, python is not an implementation of python.
These benchmarks are always funny, because real systems use different components, yet the benchmarks stick to some fake, non-real-world way of measuring.
Oh, the garbage collection in java pauses for multiple seconds soemtimes... but it's not slow because we ignore that in our benchmarks. Oh, it's not fast the first time, because the jit hasn't warmed up? Let's ignore that in our benchmarks too. Um... yeah. Good one.
This benchmark is also flawed to since people would probably use numexpr in the real world. Which is much faster than plain numpy. So python would be even faster than they say.
Mercurial(hg) is now faster than git. Git is written by great C hackers (including Linus no less), and yet hg is faster than git. See the facebook benchmarks for evidence.
Using the right tool for the job can mean using multiple languages together for where they are best. Want clarity and performance? Then C/asm + python is an ok combination.
> optimization by precomputing F values
> I also optimize by skipping the rest of the convolution if the first result isn't zero.
If you don't measure implementations of the same algorithm, you hardly have a fair language/library benchmark.
Put another way, one of the benefits of Python (and drawbacks of using an external library) is that you have more control over the algorithm and exactly what it does.
That said, a sample size of one will hardly give you an accurate picture.
"Measuring implementations of [different] algorithms is how you benchmark algorithms"
Would you exclude use of stdlib parts that are written in C? Would you say Javascript can't run serverside cause Node.js is not part of your imagined "core language"? Or it doesn't say much about the speed of C when you use a better/more optimized compiler or compiler flags?
Python apps CAN be fast. Python itself isn't. It's dishonest to do a NumPy benchmark to show how "Python" is fast if the article implies that all code written in pure Python will be as fast. Then newbies will come, try to write fast algorithms and find out, they have to rewrite them in a faster language to get that advertised performance.
In other words, it's nonsense to discard Python with NumPy as an option for fast computations just because we can imagine an imaginary world where NumPy was written differently, purely to penalize this environment for having used more than one language.
To be honest, we should benchmark what we actually have, not imaginary made-up handicapped versions of the things we are judging.
The honest thing would be to say "yes, Python is slow, but you can use some fast modules written in C".
You can even go farther and say that if you're going to use Python for non-trivial projects you better learn C (or some C generator like Cython).
That overhead is the price you pay for using Python so it's what matters when you compare languages for CPU bound projects.
I think interpreter overhead and language ecosystem performance are probably best looked at as separate questions.
For a normal web application the request flow goes something like: nginx (WSGI) -> uwsgi -> web application code -> psycopg2 driver -> postgres. Only the web application part is written in Python, so for practical purposes you actually have a C stack that uses Python for business logic. Loads of libraries, from json parsers to templating libraries include optional C code for speedups.
And if you really have these performance characteristics (hint: it's unlikely), maybe it's time to get a edge caching CDN? Cutting 400ms of latency as you cross from Amsterdam to California is going to be the easiest performance boost you ever got
If I build an application in Java and Python, with the same database backend, running the exact same set of SQL queries, the Java application should perform better.
E.g. a DB that fits in RAM is different, of course. It is hence easy to create benchmarks that generates every possible result.
So is your comment relevant to my point? Is there something about that benchmark which contradict the previous thumbs rule?
(And yes... With lots of calculations, scripting languages aren't a good idea either in many cases. Also obvious.)
The whole rise of memcached and NoSQL should pretty clearly indicate that many developers are finding their database to be the bottleneck.
There's much less of a push for high performance languages, even though there are many that are also quite nice to work with (eg, Clojure). Since this is a Python discussion, searching for "Django PyPy" and "Django NoSQL" should be instructive.
You're combining a false dichotomy with snark, which really shouldn't have a place here on HN.
If processing speed is needed... well, note that databases are seldom written in scripting languages.