3 ms·
Just as a random example: https://www.reddit.com/r/programming/comments/3p6r2v/i_wrote_a_c_preprocessor_in_python_its_25_times/ https://www.reddit.com/r/progra
by byuu 11y ago
Just as a random example:
https://www.reddit.com/r/programming/comments/3p6r2v/i_wrote_a_c_preprocessor_in_python_its_25_times/ https://www.reddit.com/r/programming/comments/3p6r2v/i_wrote...
I've constantly had similar experiences. I tried to write the GUI portion of my programs with Python and PyGTK. I needed to write a simple function that scaled up a bitmap from 256x224 to 512x448. A nearest-neighbor pixel doubler with no interpolation, color conversion, or anything else. It ended up running at around 30fps with nothing but the scaling, on a Core i7-2600k processor. And when I asked for help in optimizing it, nobody could really improve the Python, and they recommended I write "the slow parts" in C as a shared library, and invoke that from the Python GUI.
It's okay to be 10%, 30% or even 50% slower than C. But to be 2500% slower or more is completely unacceptable for production code. That level of performance only works on websites with small amounts of traffic, or on the simplest of applications.
The root problem here is of course dynamic typing. That makes scaling both performance and code size much more challenging.
Java is certainly vastly better, but the garbage collection and its stalls, wasteful memory usage (I've seen our production servers bog down with Tomcat eating up all the RAM on the server for simple programs), and overall extreme negatives of the language itself (no unsigned integers, limited to single inheritance, terrible support for generics [maybe this has changed recently?], etc), plus the legal issues that Oracle is saddling the language with, make it an unacceptable alternative.
C# might have been better if Microsoft ever cared about any platform other than Windows.
Both dynamic typing and garbage collection are the wrong ways to solve the problems of C. Rust is the closest I've seen to addressing the real problems, but it coming from Mozilla (with their terrible record with Firefox), and the syntax being so radically different from C, I think will chase a lot of people off.