Live data from Hacker News

Python is Slow, and I Don't Care

medium.com

41–50 of 69 posts

Re: Python is Slow, and I Don't Care

#41
post #7

"A company’s most expensive resource is now its employee’s time. Or in other words, you. It’s more important to get stuff done then to make it go fast." Now take this sentence and apply it to the end user of your software.

[deleted]

Re: Python is Slow, and I Don't Care

#42

Earlier quoted context omitted.

> almost all of YouTube was written in Python and has or is still being rewritten in C++, Java, and Go, saving XX millions of dollars per year of CPU time. If you reach YouTube scale, maybe the CPU savings > developer time. But I don't think you will reach that scale if you start with C++. Completion will outpace you in no time.

There are middle grounds between c++ and interpreted Python that have the same productivity as python and better performance.

Correct. Like writting in python, but optimizing the "bottlenecks" in C/C++/Cython

Re: Python is Slow, and I Don't Care

#43
post #11

If your reasoning is productivity above everything, therefore the only solution you can think of is Python, I call BS. As a Googler, I could relate countless stories of systems that were cobbled together in Python and then scaled up with massive investment, then later rewritten in C++ or Go, and generally ran with 100x fewer resources. Hell, from what I can tell, almost all of YouTube was written in Python and has or…

+1, not speaking for Google

With large systems you want assurances at compile time, something that Python can't give you much of. When you have a huge system with many modules that interact in ways you can't expect anyone to map out without staring at a lot of code, it pays to have a stronger type system and fewer runtime errors.

For experimentation and small-scale work, Python's great. Single client application? Fantastic (e.g Dropbox). Giant web service or distributed application? Starts to show its ugly sides quickly.

Re: Python is Slow, and I Don't Care

#44
post #28
post #11

If your reasoning is productivity above everything, therefore the only solution you can think of is Python, I call BS. As a Googler, I could relate countless stories of systems that were cobbled together in Python and then scaled up with massive investment, then later rewritten in C++ or Go, and generally ran with 100x fewer resources. Hell, from what I can tell, almost all of YouTube was written in Python and has or…

> then later rewritten in C++ or Go, and generally ran with 100x fewer resources This kind of story comes again all the time, but the most important detail is always missing: how much of that 100x can be attributed to the language, and how much can be attributed to now I know the domain better, I know where the pitfalls are, how to model the problem, and when I need to optimize ? Because arguably the second one can b…

It's about half and half, 50x comes from the language and 50x comes from experience. The important part is to add those factors together by good management.

Re: Python is Slow, and I Don't Care

#45
post #11

If your reasoning is productivity above everything, therefore the only solution you can think of is Python, I call BS. As a Googler, I could relate countless stories of systems that were cobbled together in Python and then scaled up with massive investment, then later rewritten in C++ or Go, and generally ran with 100x fewer resources. Hell, from what I can tell, almost all of YouTube was written in Python and has or…

Well, there are two ways of looking at this: 1. Decision to use Python created unnecessary extra work (your point); 2. Executing (not just prototype) with Python, then re-writing and re-optimizing your code in a 'leaner'/lower-level language is a valid approach given that's how Youtube and other highly successful Google products and services evolved.

I think both are valid approaches depending on your application, available resources, nature of incentives, and the speed at which your market moves.

Re: Python is Slow, and I Don't Care

#46

Earlier quoted context omitted.

There are middle grounds between c++ and interpreted Python that have the same productivity as python and better performance.

Correct. Like writting in python, but optimizing the "bottlenecks" in C/C++/Cython

Or choosing a language that's inherently somewhere in the middle (go).

Re: Python is Slow, and I Don't Care

#47
post #28
post #11

If your reasoning is productivity above everything, therefore the only solution you can think of is Python, I call BS. As a Googler, I could relate countless stories of systems that were cobbled together in Python and then scaled up with massive investment, then later rewritten in C++ or Go, and generally ran with 100x fewer resources. Hell, from what I can tell, almost all of YouTube was written in Python and has or…

> then later rewritten in C++ or Go, and generally ran with 100x fewer resources This kind of story comes again all the time, but the most important detail is always missing: how much of that 100x can be attributed to the language, and how much can be attributed to now I know the domain better, I know where the pitfalls are, how to model the problem, and when I need to optimize ? Because arguably the second one can b…

I've written 1 to 1 (algorithm) code from Python to Rust and seen orders of magnitude performance/ memory difference. This was not a 'rewrite it with lessons learned' this was 'rewrite it as similarly as possible'. It is the language (and runtime).

Re: Python is Slow, and I Don't Care

#48

Earlier quoted context omitted.

Maybe I'm daft, but I don't quite understand what your getting at.

translated: We dont care if our software runs like crap for you because our time is more important than your user experience.

Maybe this is saying the same thing, but I interpreted it as "If a handful of developers write an application that millions use, then saving a few seconds per user can add up."

I've seen this applied to the Linux kernel, where saving a few microseconds in a system call, when multiplied out to the billions of machines running Linux, saves hundreds of years of CPU time.

With that said, most services don't have as many users as Linux.

Re: Python is Slow, and I Don't Care

#49

Earlier quoted context omitted.

There are middle grounds between c++ and interpreted Python that have the same productivity as python and better performance.

Correct. Like writting in python, but optimizing the "bottlenecks" in C/C++/Cython

Why not just compile/JIT the python, always? I feel like I'm taking crazy pills! :) Even when you write the hot bits in C++ you still have a python interpreter thrashing the CPU caches and using up ram.

and now you have to context switch in your head more often, and the build process is more complex, and usually there is a cost when you do the FFI.

Re: Python is Slow, and I Don't Care

#50
post #11

If your reasoning is productivity above everything, therefore the only solution you can think of is Python, I call BS. As a Googler, I could relate countless stories of systems that were cobbled together in Python and then scaled up with massive investment, then later rewritten in C++ or Go, and generally ran with 100x fewer resources. Hell, from what I can tell, almost all of YouTube was written in Python and has or…

I bet the youtube founders would disagree with you. They probably do not regret launching it quickly in python, selling it to Google for over a billion dollars, and letting Google spend the next decade rewriting it.
Post reply on HN