Is Python slow?

Standartuye

Regular Member
Jun 26, 2013
426
127
Hi everyone,

Just a quick question about the video I have watched. The guy was saying python is not working multithread like java or javascript and this makes it slower.

I was just wondering If I learn python in order to use scrape purposes by using let's say selenium, how fast does it work?
 
Depends on the environment, but for 90% os use cases there won't be any differences.

Python is a general-purpose language so it will always be slower than purpose-built languages such as JS or PHP for web.
 
Selenium itself is slow since it takes a lot of computing power. Its like opening multiple chrome browser which you obviously know that it would make your computer slow, sometimes it take 10% CPU on one of my old PC. Contrary to what the guy said, python is actually relatively fast, and you can multithread on Python as you would do in almost all other language like C#. To sum it up, python is not slow.
 
multithreading is really a reference to whether the language can run different functions at the same time concurrently within one process. every server can handle multiple threads from requests, so you just automate that rather than doing multi threading in your code.
 
Yes, python is slow, with selenium even slower. But you won't notice a big difference as long you are not doing thousands of operations per second.
 
Saying that "Python is slow" is incorrect -- we always need a baseline to compare against. If we're comparing Python to Java, the former is indeed slower in terms of raw CPU performance -- but a Google study has shown that CPU bottlenecks are rare, so this is an irrelevant metric.

Here's another way of comparing programming languages: by developer time.
median-hours-to-solve-a-problem-in-different-programming-languages.png

median-lines-of-code-in-different-programming-languages.png


In my experience, this is a much more important metric -- and Python blows its competitors out of the water.
 
multithreading is really a reference to whether the language can run different functions at the same time concurrently within one process. every server can handle multiple threads from requests, so you just automate that rather than doing multi threading in your code.
so by saying multithreading, it doesn't mean to handle multiple requests, it means not to perform multiple functions in one process right?
 
so by saying multithreading, it doesn't mean to handle multiple requests, it means not to perform multiple functions in one process right?
exactly. so i write in php and im limited to waiting for each function to complete before moving onto the next. however when i use JS, i can run multiple functions at the same time to get data from apis ect.
as a selenium/php user, (the same applies to python), you can setup cron jobs to stack up the requests.
it's no different to having webserver with multiple users using it at the same time. servers and all languages are designed for that. just not as i mentioned, multiple functions running at the same time.

hope this helps
 
It really depends on what of processing you're doing with the language. Python is great with manipulating numbers and processing data sets for example.

In general though, Python is pretty fast relatively to other general purpose languages.
 
python from knowledge is the most effective language for using selenium as java needs more code and other languages are like homemade bindings. python has great support for it so i assume it is a fast implementation of selenium.
after my current project i am going to learn puppeteer. if you arent an expert in selenium yet, maybe puppeteer would be better for cpu usage.
 
I dont know what all the others here are on about, but python is very slow compared to other languages. This is because it's an interpreted language and doesn't get precompiled.

Makes it up to 100x slower than languages like C.

However you can still do multithreading in python.
 
also speed of language/library is only 10 percent of it, optimizing yout algotithm is the rest.
 
"The guy was saying python is not working multithread like java or javascript and this makes it slower. "
wrong
wrong
wrong
 
Hi everyone,

Just a quick question about the video I have watched. The guy was saying python is not working multithread like java or javascript and this makes it slower.

I was just wondering If I learn python in order to use scrape purposes by using let's say selenium, how fast does it work?
In my experience, not any slower than any other language like js or java. I mean, ofc your code will be slower working with big datasets but I think python or R is the best when tryna work with big datasets. Its still faster than the other languages you can use especially JS.
 
I dont know what all the others here are on about, but python is very slow compared to other languages. This is because it's an interpreted language and doesn't get precompiled.

Makes it up to 100x slower than languages like C.

However you can still do multithreading in python.
In it's implementation of whatever algorithm and program he writes, it'll be the fastest to chop up and the run-time will also be negligible at best but you are right that it is slower due to the way other languages are compiled.

In my personal experience, it rarely is the language that makes any difference to speed as compared to the algorithm being utilized and from all languages I've used, Python is the easiest to implement algorithms and test them. But yeah, you're right, saying Python is faster than other languages in it of itself is wrong.
 
Saying that "Python is slow" is incorrect -- we always need a baseline to compare against. If we're comparing Python to Java, the former is indeed slower in terms of raw CPU performance -- but a Google study has shown that CPU bottlenecks are rare, so this is an irrelevant metric.

Here's another way of comparing programming languages: by developer time.
View attachment 141281
View attachment 141282

In my experience, this is a much more important metric -- and Python blows its competitors out of the water.

That chart is nonsense. It totally disregards the programmer and the program.

The median lines of code, does that ignore the immense amount of tests required to make python code reliable, making sure you don't have a space out somewhere, or typed , instead of . Which the compiler will do for you in c# java

How about refactor time?

Can you write quick scrappy code in python in a few lines that is unmaintable, sure. But equally you can do that in c# and java too.

How about spec changing and having to change the design mid project. Now those 1000s of tests you wrote to replace a compiler have to be rewritten, remocked.

But the reason the image should be thrown away, median hours to solve in c! Are you kidding me

Useless image put together by a python fanboy that shows nothing of any merit.

You can productive in any language you KNOW. You can write quality code in any langauge. You can write crappy code in any language.


Is python slow? Well technically yes if you want to get down to metric testing. But will this relative slowness affect any programmer? No.
 
I also want to add that selenium is slow. But you can always use the requests module in python to increase the speed of the program dramatically, but the only thing is that you have to know how to bypass the API and security of the website, which can take some time to learn. Just know almost nothing is impossible, some website API is really hard to bypass because human creation always have human mistake, I have seen several instance of this even on big branded website.
 
python from knowledge is the most effective language for using selenium as java needs more code and other languages are like homemade bindings. python has great support for it so i assume it is a fast implementation of selenium.
after my current project i am going to learn puppeteer. if you arent an expert in selenium yet, maybe puppeteer would be better for cpu usage.

What’s the benefits of puppeteer? Cause after my recent selenium project I promised myself I’d move on to learning something else. So im a bit curious
 
Selenium itself is slow since it takes a lot of computing power. Its like opening multiple chrome browser which you obviously know that it would make your computer slow, sometimes it take 10% CPU on one of my old PC. Contrary to what the guy said, python is actually relatively fast, and you can multithread on Python as you would do in almost all other language like C#. To sum it up, python is not slow.

Well python actually doesnt allow true concurrent multithreading because of GIL.
 
Back
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features and essential functions on BlackHatWorld and other forums. These functions are unrelated to ads, such as internal links and images. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock