Cheers, Maciej Fijalkowski
I would say, ballpark, $100k. Email me at fijal at baroquesoftware.com
EDIT: the actual figure depends precisely on what you want, which parts of the stack have to be exactly how fast etc.
That benchmark is pretty meaningless anyway, IMO. Here are some halfway decent, official and up to date benchmarks comparing python 2 and python 3[2].
Python 3 is slower in some areas, noticilby startup time, but it's not all doom and gloom. It's faster in a lot of places. And productivity is hard to benchmark, but IMO py3 is way better in the area.
1. https://github.com/MikeMirzayanov/binary-heap-benchmark/blob...
2. https://speed.python.org/comparison/?exe=12%2BL%2B3.6%2C12%2...
Would you please not post uncivilly to HN, regardless of how annoying you find someone's comment? This kind of thing degrades discussion and provokes worse from others. We're hoping to do better than that here.
The account also has a history of being snarky.
C:\Test\PyBench>py -2 test.py
Done in 1188.308127
C:\Test\PyBench>py -3 test.py
Done in 1454.897614
Please bring up to date benchmarks to the discussion, and stop complaining about old problems.Note: adjusted I the workload to be 1000 less iterations, to get the results fast for this comment, so this numbers aren't comparable to the list in the github repo. But even if I hadn't done that, they wouldn't be because I ran these in my system.
Can I ask what you need the speed for? How long are your reports running? Because a lot of times the reports run in under a few minutes and people just don't sub-set their data to code on. People feel it is "BIG DATA" when it is just annoying data that takes less then a minute to spit out.
I think there'll be more traction expanding the libraries for Julia, Nim, or Kotlin, all of which are much faster than Python, and similar in expressiveness. It's probably easier to create an optimization/ML/linear algebra/RNG/whatever library in Julia, Nim, or Kotlin than trying to get good performance out of R or Python.
I completely understand PyPy and numpy and why Python and R became popular, because there was a need for expressivity in the numerics space and other languages weren't offering it. But if you've been following them for long enough, it's clear that both of them had problems under the hood. I think people just crossed the boundary of appropriate use at some point, because the language syntax is so appealing for these sorts of things.
Maybe I'm wrong about all this and Pypy will deliver but I'm not holding my breath any longer. No offense to the Pypy developers--I'm immensely impressed with their work, and they've produced much more than I ever thought--but I do see some sort of asymptote. I think it would take some serious corporate influx of effort like what happened with javascript, and even then I worry that compatibility issues would rear their head. My guess is the Python 2-3 split would become a Python 2-3-Pypy split--maybe that's fine though.
I mean... it takes 28 bytes to store a single integer in Python.
> > sys.getsizeof(1)
> 28
I think sponsorship of PyPy would be welcome -- but it seems non-obvious where that would come from.
Javascript has the fortune of being the language that drives a very important platform -- and Chrome has been a particularly strategic investment for Google to have more control over the web than it ever has before. Java has Android... Python unfortunately doesn't have that sort of standing in any area that I'm aware of.
Besides the enterprise space, there are lots of embedded devices running it.
- Proof: a benchmark based on Python 3.3 (Python 3.3 was released in 2012).
I think Guido wants the reference implementation to have a simple and straightforward codebase, a JIT is anything but that.
https://github.com/Microsoft/Pyjion
The core of it is there and it's been accepted into the main trunk, but we haven't had the cycles to do quality codegen yet.
What you could do is much simpler --- :
Split your Python application in two parts:
1. Keep your functions that make heavy use of Numpy and Scipy under CPython; expose your algorithms/functions as a web service/REST service/etc running under CPython.
2. The rest of the application, which of course needs to call the functions in (1), can be written in PyPy and call the web service in (1). This is where you would put the general-purpose stuff like web, graphics, database access, and of course all symbolic manipulations that do not require Numpy/Scipy.
I think this is a simple, workable solution.
Easy gluing of other languages together has long been something I considered a strength...but I suppose to each their own.
> Why can I not choose to write Python and it be fast??
Well there are lots of reasons...including implementation issues and I don't know them all...but I think Python has a very clear productivity niche. Personally, I am ok with Python trading performance for productivity. For the most part, I haven't had Python be so much of a bottleneck that writing a very small part of logic to be performant hasn't solved my use case.
> And yet Python 3 is getting slower. Don't agree?
Yeah I don't agree...that benchmark uses Python 3.3. The corner on Python 3 performance over Python 2 started turning around 3.4. Perhaps a talk from this years PyCon would help illustrate:
https://www.youtube.com/watch?v=d65dCD3VH9Q
> But PyPy is proof that Python can be fast.
Indeed, I would even say that Cython is even more proof that there are frontiers of performance that could be explored. But with PyPy (as with Cython) their are sacrifices you have to make.
Personally, I think the most promising performance improvement that is tantalizingly close for me is Larry Hasting's Gilectomy project:
> https://www.youtube.com/watch?v=pLqv11ScGsQ
But at the same time, I am not sure that Python ever needs to be fast running in CPython. With `WASM` perhaps it is better to just compile Python.
I don't know, performance in Python has always been a mixed bag...but personally I think it doesn't get much focus because it doesn't really serve Python's target niche. I don't know if there ever will be (or should) be 1 language to do everything...and as it is Python is a good "productivity" focused language to have in your toolbox so-to-speak.
Then you probably should not use Python, python is more of a glue language which you should strive to make your program looking like a business logic, in real word to solve this problem you would write code such as this:
import time
if __name__ == "__main__":
start = time.clock()
N = 10000000
h = list(range(N))
h.sort()
for i, v in enumerate(h):
assert(i == v)
print("Done in %f" % ((time.clock() - start) * 1000))
$ python3.6 heap.py
Done in 2389.877000
Or if heap needs to be used: import time
from heapq import heapify, heappop
if __name__ == "__main__":
start = time.clock()
N = 10000000
h = list(range(N))
heapify(h)
for i in range(len(h)):
assert(i == heappop(h))
print("Done in %f" % ((time.clock() - start) * 1000))
$ python3.6 heap.py
Done in 10716.348000
Micro benchmarks are silly because you'll never do those things in real code.Then I can ditch Cpython and its stockholm syndrome slowness forever
Hopefully a matplotlib-equivalent will materialize on Clojure (where Linear Algebra is plenty fast and the language itself is fast-enough out of the box) so I can be done with Python forever.
Hence why I am looking forward to Julia making inroads into Python's domain, as that might be the butterfly effect that triggers PyPy adoption.
So the fast functions they are using are likely compiled, they aren't necessarily library functions.
1. Does anyone know the latest update on NumPyPy? PyPy for me is just not a usable proposition because I heavily use Numpy (and Scipy et al). So I am forced to use slow Python + fast Numpy or slow Numpy + fast Python. Very saddening. The C-Extension is just so off the pace, NumPyPy was meant to solve that quandry.
And I know some smart Alec will trot out the usual 'downshift into C' line that everyone (including Guido) use as the final goto solution for performance but that is simply a disgrace in 2017. Even JavaScript is fast. Why can I not choose to write Python and it be fast?? And yet Python 3 is getting slower. Don't agree? Look at these benchmarks of Python heaps written in Python (not using the C based builtin heapq) https://github.com/MikeMirzayanov/binary-heap-benchmark Python generally is off the pace but Python 3 is about twice as slow as 2 and miles off JavaScript.
But PyPy is proof that Python can be fast. It makes quote/unquote "Pure Python" within striking distance of Go and and when I run that test suit on PyPy, its similar to the Node.js score. Why does this matter? Because I want to write bloody Python not C.
And it is so tantalisingly close - look at a blog post like: https://dnshane.wordpress.com/2017/02/14/benchmarking-python... The performance of the Fibonacci Heap that someone wrote in quote/unquote "Pure Python", when run in CPython can never compete with HeapQ (the C based builtin lib), but on PyPy it can. Fast code written in Python. So what are the problems holding back PyPy? I think possibly money and number of devs working on stuff. Javascript had Mozilla, Google, Microsoft and Apple in a browser war + loads of open source input.
But is the biggest stumbling block not Guido himself and the core Python devs? Do they just philosophically not agree with PyPy or is it just disinterest?
Well whatever it is, it is heart-breaking to want to write fast code in my favourite language and leverage all its power including Numpy/Scipy etc and not be able to. And yes my use-case is perhaps quite unique, a very CPU intensive service that ideally computes and returns a real-time calculation (that includes 500k function calls) in 10-50ms.
But getting fast Numpy in the PyPy mix (i.e all the speed of the JIT + no worse Numpy) would be a HUGE step forward for me in PyPy adoption. What is the latest? How can I help?