The current situation of Python's performance is really pathetic. Thanks for the project, we need to make Python great again otherwise the future is for Go, Elixir and Rust.
People are obsessed with performances, while my experience is that for the enormous vast majority of projects you could run on something 10 times slower than Python.
Actually, I have a friend of mine running a streaming website. He banks 15k€ a month for 400k daily users.
Python perf has zero inpact on his project. Python ease of use and maintainability means he, as a terrible (really terrible) programmer have been able to keep the site up and running for 5 years.
I worked in africa for a while. Needs for Python perf ? Zero. Needs for code that is understandable and easy to write. A LOT.
Moved to geographes working on SIG. Needs for Python perf ? Hell the GIS engine does the heavy work, they don't care. But they don't undestand jack about programming and need things done. Python let them to do it cleanly.
Or I moved to embeded programmers. Hardcore C coders that are using Python to test their boards. Need for Python perf ? They don't even know what you are talking about. For them perf is assembly. They want something that is fast to write, with 10000 libs available.
As a trainer and dev I teach Python on a monthly basis. JS training. Jeez, where do I begin ? If you let them do something more than a one-file stuff, they are lost. Python ? They are project ready in no time.
Data mongers ? They have numpy and databases.
Now myself ? I code in Python all the time. I've seen many slow sites. It's always either because of the DB queries or the static assets. Never about the server side language, be it Python, JS, Ruby or PHP.
Coding in Go, Elixir or Rust for task where my productivity is more important than the machine output makes no sense. Especially in a world where an unmetered VPS cost 3€/month (https://www.ovh.com/us/vps/) with 2 GB RAM and 10 GB SSD. I can just take 100 of those and build a freaking skynet without making my company accountant blink.
We are not google or facebook (and they do use Python BTW. Fb just announced they are migrating to 3 massively).
So yes, more perf is nice. I would literally pay to help having better perf because it's always a good thing. But stop pretending you need it so bad, because you would be magically the 0.1% that actually do on all the forum post where people are saying they are.
It's a nice to have.
If you want to switch to something else, just admit you are following a trend. Dev always are. They love what's new and shiny. Nothing wrong about it. But those "Python is slow I'm out" posts are ridiculous. Dropbox can say that. Bank of America can say that.
Yeah. I mostly agree with this. Developer productivity is the best thing to optimize for. These are the most important metrics for that, in my opinion: Code readability, good editor w/ intellisense, fast test suite, solid library ecosystem.
It would be interesting to see an analysis done of developer productivity across languages to find out which language provides the best over all value for new and existing codebases.
On the higher level languages I've used (PHP, JS, Ruby, JS, Python, Basic, Bash, Perl), Ruby and Python are clear winners : easier to read, organize and promote more solid code.
But Python provided me with a better experience than ruby because:
- it's very useful outside of the Web as well. Ruby is still very much tied to RoR.
- the Python community value documentation, tests and dislike too much magic, like monkey patching.
- as a trainer, making people setup Python + venv and make them use it is wayyyy easier than rvm.
Then second to them would be JS. It's a terrible language, but it's the only one on the browser platform which is amazing. Having code that natively manipulate GUI, sound and video in a few line is the most motivating experience you can get when you start coding.
I'm not really buying into that argument. I have seen Python code that is unreadable, actually a lot worse than 90s PHP/Perl. Take a look at modern Perl please.
Perl 6 is better, but it still offloads a lot of the logic parsing to the human brain.
Create an array or string, take the last element and display it:
<A B C>[* - 1].say;
The same in Python:
print(['A', 'B', 'C'][-1])
The same in Ruby:
print ['A', 'B', 'C'][-1]
The first version is a good example of what perl is good at : it's short to write. The Python version is more verbose.
But, your brain has to do the following:
- Scan the element to realise A, B and B are strings. Perl can have strings with "A", but in this here you can write it without it. So when you read, you need context to know what's going on. The Python version make it clear it's a string.
- Then figure out the that the separation is on the spaces. Python put comas, so you don't have to parse negative space in your head.
- the you have the "*" you need to integrate to get context of what element you use. Then you get the ";" which is just noise.
Small elements like those add up very, very quickly in a code base. Every time your brain has to gather context before understanding what it reads, you add cognitive load. You can't scan the code.
PHP, Perl and JS by nature have a higher cost that Ruby or Python. The laters have been design with readability in mind. You have less tricks, they are more boring. And easier to read.
Of course you have many other small issues with perl, like figuring out why you use .say but .WHAT in uppercase. Why the shell by default on some linux setup have a broken history. Why you can leave out the .say most of the case in the shell, but sometime if you don't use it nothing is displayed. That you have to install the rakuto package on Ubuntu but run the perl6 command to start the shell, etc.
All in all, Perl is a neat technical achievement, but has not been very ergonomy oriented.
Is Russian the hardest language to read for someone that doesn't know Russian?
C type brackets and semicolons are second nature to a lot of people.
Perl has a lot of built-in stuff that makes a lot of sense when you have learned it.
Your example in Perl 5:
print qw/A B C/[-1];
I instantly know that qw has to do with a list of words, and the qw// can be replaced with qw(), qw[], qw##, etc to make the code the most readable to you.
Can be written like this if you like the commas and quotation marks:
Print the number of elements and assign it to a variable at the same time:
print my $num =()= qw/A B C/;
You CAN very easily write "boring" readable Perl if you want to. But the power is there when needed. One letter variables, insane uncommented regexes, removing all whitespace etc is generally not how modern Perl programmers code.
Take a look at some code in Python that is done by someone less disciplined (or intentionally obfuscated). It is as unreadable (or worse) as the obfuscated C and Perl from the late 90s.
Of course you can get used to anything. But even if you get use to run, walking is always easier.
Using so much context to convey meaning implying a lot of processing even if you are train for it, so you have an additional load. Using so many symbols to convey meaning as well.
By design, Perl is harder to read if you write it the way it's intended to be used.
Just like Russian is harder to read than english because the language has some concept like letter effecting other letters than implies you brain need to backtrack.
Eventually, if you become a master at it, you won't feel it. But you can only master so many things in life. Most of the stuff, at best, we become very good at it. But very good means you still use your brain CPU. There is no way around it.
That's why language design is important, and to me, Perl failed this big time.
It's not just about habit either. Take Erlang for example. It is a very different language. It's hard to reason about. But it's not very hard to parse in your head because it's quite consistent and regular in the way it unfolds.
Erlang has other issues of course and I wouldn't recommand it over Perl for non highly // related tasks.
But yes, Perl has been written to be clever. This is not a quality in language design. Handy yes. Intelligent yes. Clever, not so much.
"Using so many symbols to convey meaning as well."
Actually as a visually oriented person I find it very helpful. And logical:
$ - a single thing
@ - a list of things
% - a hash (associative array, key-value pair list)
\ - a reference to any of the above
my @fruits = qw/Apple Pear/;
my $company = $fruits[0];
# A reference can be declared directly, this is a \%
# with a nested \@. Encodes nicely to JSON as an example.
my $hash_ref = {
fruits => [
'Apple',
'Pear'
]
};
my $apple = $hash_ref->{fruits}[0];
"By design, Perl is harder to read if you write it the way it's intended to be used."
What way is it intended to be used? Perl 4 style mixing Perl and shell script?
Perl 5 has had (roughly) yearly releases since 1994 and is now at 5.24. Quite a bit has changed in that time and the language has evolved and improved.
There are modern non blocking web frameworks, great database support, several modern OO systems etc.
And Perl still works great shell script style (you can choose to code in a clean style) and for the most parts there is great backwards compatibility.
Perl is definitively about getting the job done. Hence the slogans "make easy things easy and hard things possible" and "there is more than one way to do it".
For someone well versed in Perl something like idiomatic Python becomes a prison where it is hard to get the job done because you can't freely express yourself.
I think it's not just philosophy or language design but people are wired differently. And Perl is a lot of fun for creative individuals.
Lastly, I am looking forward to the next years when the Python community has to clean up because of its current popularity with novice programmers. That's what Perl has been through and that old novice code is also where most of the undeserved reputation come from.
Perl 6 is a different language by the way. It is interesting but hardly production ready if you ask me. It would be better if it was called something else but BDFL you know.. Capital letters stuff come from C# since one of the main Perl 6 devs was strong in that..
Exactly. Every language can scale the web servers easily. Every language cannot scale the SQL server easily.
Highest level language that's maintainable wins. That's why Python is incredibly popular. The real snag to Python is the flippant disregard to backwards compatibility even though it's already massively popular. Fragmenting the ecosystem.
My experience is that people that scream the loudest about "performance" are often also people that make micro-benchmarks and derive ridiculous claims from them, and also seem to often be the people that otherwise don't know much about "performance", or be in need of it.
For the by far largest share of web applications, easily everything to the 99th percentile, performance, in the "sense" of this benchmark, is wholly irrelevant.
>For the by far largest share of web applications, easily everything to the 99th percentile, performance, in the "sense" of this benchmark, is wholly irrelevant.
Amen to that. Performance is incredibly low on the list of concerns for most businesses I've worked for. Getting code out quickly and making it work reliably are usually priorities #1 and #2.