On Sat, Feb 24, 2018 at 5:05 AM, Steven D'Aprano
<steve+comp.lang.pyt...@pearwood.info> wrote:
> But guess what? The benchmarks are flawed. The performance of real-world
> Julia code doesn't match the performance of the benchmarks.
>     "What’s disappointing is the striking difference between
>     the claimed performance and the observed one. For example,
>     a trivial hello world program in Julia runs ~27x slower
>     than Python’s version and ~187x slower than the one in C."
> http://zverovich.net/2016/05/13/giving-up-on-julia.html
> Admittedly "Hello World" is not what *I* would call a real world program,
> but that's just an illustration of the discrepancy between the
> performance in artificial benchmarks and the performance in useful code.

No, but Hello World is a good test of application startup time. (A
null program doesn't always test everything, and doesn't look very
good either.) If Hello World takes half a second to run, you have a
language that is terrible for short scripts or command-line tools.
That doesn't mean it's a "slow language" necessarily - nor even a slow
interpreter, which is what you're actually testing - but it does mean
that, well...

rosuav@sikorsky:~$ time pypy -c 'print("Hello, world!")'
Hello, world!

real 0m0.429s
user 0m0.036s
sys 0m0.032s
rosuav@sikorsky:~$ time python -c 'print("Hello, world!")'
Hello, world!

real 0m0.024s
user 0m0.016s
sys 0m0.008s

... CPython does have its place still. Or maybe...

rosuav@sikorsky:~$ time pypy -c 'print("Hello, world!")'
Hello, world!

real 0m0.050s
user 0m0.016s
sys 0m0.032s
rosuav@sikorsky:~$ time python -c 'print("Hello, world!")'
Hello, world!

real 0m0.022s
user 0m0.016s
sys 0m0.004s

... that PyPy doesn't live in my disk cache the way CPython does. :)
PyPy is still slower than CPython for startup time, but not THAT much
slower. However, if you DO have something that has a ton of startup
overhead, you need to know about it. (Interestingly, I was actually
able to compile and run a C hello-world in comparable time to PyPy,
once the cache was warmed up. Curious. I expected that to be slower.
Once again, it proves that intuition can be extremely wrong.)

In terms of "which language is faster?", real-world code is both the
ONLY way to measure, and a completely unfair comparison. Life is


Reply via email to