As Python2 is finally being put to bed I thought it was time I moved to Python3 but when I did so I found the same code is running between 20 and 40% slower in Python3 than it was in Python2.
What gives? I've searched around a bit but haven't found anything that sounds like a plausible explanation and most places are saying that Python3 is faster than Python2 now.
It compiles to some kind of binary code the first time you run it. Maybe you just had your python2 code pre-compiled.
Matthew Allen
why? its faster, has a better syntax and just like python a lot of libraries
Charles Ortiz
happens if you don't use Perl like a sane person
John Cox
Na, every time I test it I get similar results. I've done it several times now.
Ryder Adams
happens if you don't use OCaml like a sane person
That being said, have you ruled out start time? It's one of the things that have gotten constantly worse...
Cameron Hall
>That being said, have you ruled out start time? Yeah, it's most definitely not just start time.
Julian Gray
Python3 has always been slower than Python2 in my experience and the experience of everyone I've talked to about it. I'm surprised you're seeing the opposite opinion online.
Either way, Python is slow. If you're doing things that need to be performant, use a different language (or at least get it working with pypy)
Josiah Barnes
It's not that I am after high performance. I just want to understand why it is this much slower and how I could actually justify going to Python3. I may not be worried about performance, but I also don't want my shit to be taking 40% longer to run for no reason.
Justin Harris
>how I could actually justify going to Python3 It's supported and has slightly better syntax and semantics. >I also don't want my shit to be taking 40% longer to run for no reason Then you shouldn't be using python. CPython as an interpreter is written to be simple and easy to expand, not fast. It will waste time all over the place that other interpreters/compilers never would, and 3 only slightly more so than 2
Blake Jenkins
Just use Julia. simple syntax like Python, Python interop, but infinitely faster
Adrian Adams
If only it was 0 indexed.
Dominic Clark
>muh python3 to me the only difference was "print" not being a keyword anymore
Zachary Turner
i thought speed was one of those things you'd just expect to not have when using python is the difference really that noticeable?
Tyler Ramirez
Well those numbers are in seconds, so we are talking 75 seconds vs ~110 seconds in that particular script, which isn't even using large amounts of data yet.
Noah Green
>javascript >good syntax
Besides that, when we're talking about other programming languages, python probably has one of the best syntaxes overall. Also it is currently the best option for a script language, if you need one for any reason.
Jack Sullivan
> making excuses for python's garbage performance > takes 40% longer to execute > oh you shouldn't be using python then fuck off, moron. you're a joke. node.js is pure cancer written for web retards. it's bloated, inefficient, plus node & its "libraries" are a security nightmare. but it's great to see the usual retards trying to defend this indefensible cancer. i think it's amusing and oh so adorable.
Aiden Davis
bunch of unicode shit maybe?
Christopher Lee
if you want a fast programming language then use lua
Chase Adams
run it through cProfile
Caleb Rodriguez
you gotta be trolling programming with non-blocking calls is a major pain for most uses