How in the fuck is python this godamn slow...

How in the fuck is python this godamn slow? I expected it to be at most 5 times slower than C or Java but turns out its 20-100 times slower than them. Even Javascript is 5 times faster on V8. How can you fuck up so bad? I thought Python must be at least decently competitive since its the 3rd most popular programming langauge, but now.
This means that any application that will run for longer than 10 minutes that is written in python is completely uncompetitive.
I like python a lot but this is unacceptable

Attached: python.png (800x754, 695K)

Other urls found in this thread:

julialang.org/benchmarks/
benchmarksgame-team.pages.debian.net/benchmarksgame/program/pidigits-python3-2.html
greenlab.di.uminho.pt/wp-content/uploads/2017/09/paperSLE.pdf
jaxenter.com/energy-efficient-programming-languages-137264.html
luajit.org/performance_x86.html
github.com/greensoftwarelab/Energy-Languages
twitter.com/SFWRedditImages

How do I unsubscribe

>want it to be fast?
>>c++
>do you like free time?
>>c#
>Do you REALLY like free time and like a good little compiler who doesn't say no to daddy?
>>javascript

GET THE FUCK OUT PYTHON NORMIEKEK

Its too easy to fuck up js, which is why I don't like it.
You can assign anything to anything and it doesn't even have type hints

I don't think you're calculating this right.

>20-100 times slower
That's when you've tried hard to approach C code in the way you express yourself.
Basically you're just shit posting and sourcing your experience from benchmarks game.
Don't mislead people. It's WAY worse than you're saying.

So are saying python is faster or slower than 20x?

look at the chart at: julialang.org/benchmarks/ OP's estimate is pretty good.

Slower. In reality nobody writes code like benchmarks game code.
benchmarksgame-team.pages.debian.net/benchmarksgame/program/pidigits-python3-2.html
People don't import a library to do basic math in python. Maybe they should, they don't.
And this problem compounds when you start having more complex programs. Python code is organized around the languages constructs naturally. You'll use things like dicts and lists.
Same in C but it leads you down a different path.

None of that stuff is actually representative and it goes both ways.

Things it's used for don't care

This is evaluating pure python code. Most of things people actually do use libraries that do resource-intensive tasks using C. Like all scientific calculations are done at least using numpy, so pure python performance is irrelevant.

We need a carbon tax on companies that use certain programming languages.
Language study: greenlab.di.uminho.pt/wp-content/uploads/2017/09/paperSLE.pdf
Java shills article for the layman: jaxenter.com/energy-efficient-programming-languages-137264.html

Attached: energy-efficient-languages (1).png (907x814, 265K)

Try Pypy.

But yea, if you got larger applications, you might want to write them in a JVM language or Cpp or Lua or such.

>Even Javascript is 5 times faster on V8
Than Python? More like 20-30 times faster

That benchmark seems to be running everything on the often slow standard interpreters.

Not saying it's a profoundly wrong thing to test, but performance oriented Lua tends to run on LuaJIT ( see difference on some other benchmarks vs standard lua here, it's massive: luajit.org/performance_x86.html ), and Python is often running on Pypy or such. Try that.

Python is not a bad language per se, but it's without any doubt the wrong language to use if CPU-bound performance is crucial.
I suggest and also, consider using more efficient algorithms if possible.
If it's still too slow for your application, you may have no choice but to rewrite it in some other language.

>We compile/execute such programs using the state-of-the-art compilers,
virtual machines, interpreters, and libraries for each of the
27 languages.
And they're sure to not run interpreters. Not even benchmark game does that. Just compare benchmarksgames binary tree results for C and python and compare to the paper. Benchmarksgame shows a larger difference (approx 2x) and they use python3 -O0 on an Ubuntu machine. So I'm guessing that's the default environment.
>lua
I do find their results strange there. Need more details.

I had a look at the published git repo: github.com/greensoftwarelab/Energy-Languages

> We compile/execute such programs using the state-of-the-art compilers
Yes, it is actually just the latest upstream main releases at the time, as far as I can tell.

But one year ago, people already used Pypy and LuaJit. Even if it was further back, efforts like Stackless Python and Jython were a thing. So... that's a bit more fanfare than reality, I think. The actual tests seem more cursory than a good study [and how hard is it to test a better range of interpreters if you're going to publish a science paper, really...?].

Correction, around TWO years back. Not that it matters much. The paper is recent and pretty damn lazy "science".

what purpose does python serve than? except as a learning language (that said fuck interpreters lmao just compile that shit nigger)

Basically this.
There's no reason to use Python.

To sell udemy machine learning courses

well its taught at mit so it must be good, right?

right?

You're probably writing inefficient code.

I think python really is only good for quickly creating mini tools in less than 5 minutes, but then an experienced programmer could probably do it with a better language.

a lot of the hacking tools for consoles i see are in python, i wonder if theres a reason

No, some algos are measured with numpy or other c libraries too

A Raspberry Pi with GPIO and Python is just the modern equivalent to a Commodore 64 with a user port and BASIC.

whats gpio? so python is basically just its fast to mak and easy to revise?

General purpose IO. A raspberry pi has a bunch of pins that can be hooked up to/control external devices.

Attached: raspberry-pi-15b.jpg (633x656, 74K)

Most of the time your program will be waiting for user/network input, fuck off dumb fizzbuzzer.

cyphon

It's only a little slower than Perl calm down dude. If you need CPU bound performance use something else. People get too attached to languages.

You say that like it's a bad thing.

I have python as much as the next guy but I never understood why people compare it's speed to compiled languages.
>c
compiled
>java
JIT compiled
>nodejs
JIT compiled

The only reasonable comparison is to Ruby, and it's decently competitive, even sometimes faster.

Where did you even get numbers like 20 and 100?
If there is some kind of benchmark, why don't you share it with us?

>too easy to fuck up js
You're doing it wrong. All js written by other people, which includes you two days ago, is shit. But when you're writing it, and get absorbed by that sweet, daisychained flow, you don't care about right or wrong, you enjoy your fingers flying over the keyboard, in perfect sintony with intellisense, and you can be sure that it'll work. Well, it might not do exactly what you wanted, but the journey is the destination, right?

Assembly is missing.

>missing the point of python

>get absorbed by that sweet, daisychained flow
ascend and enjoy the sweet release of haskell