3 ms·
Exactly. And then after the "blazingly" fast clickbait title we read: "I'm (mostly) not going to show you some hacks, tricks and code snippets that will magica
by acqq 7y ago
Exactly. And then after the "blazingly" fast clickbait title we read:
"I'm (mostly) not going to show you some hacks, tricks and code
snippets that will magically solve your performance issues. This
is more about general ideas and strategies, which when used, can
make a huge impact on performance, in some cases up to 30%
speed-up."
Python CPU-bound programs are e.g. 30 times slower than C or Java, and "up to 30% speedup" makes them still 20 times slower which is really far from "blazingly".
An example (best scores):
https://benchmarksgame-team.pages.debian.net/benchmarksgame/performance/mandelbrot.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
Java 6.83
Python 259.50
- nicoburns 7y agoYep, and if you a dynamic language: Node 6.72 Or just a modern language with nice quality of life features: Rust 1.72 (All of these are seconds)
- acqq 7y agoC has 1.64, even better, I’ve intentionally omitted that, but that is the reference for cases “it doesn’t have to be new fashion but has to be fast.”
- nicoburns 7y agoYes, but writing C is a completely different, and much more onerous experience. You have no sensible strings or hashmaps in the standard library, and using external libraries is a massive pain. That's not even to mention Undefined Behaviour and memory safety issues. For most data-munging programs, python, node, java, and rust code will be roughly similar (Java and Rust will make you annotate types). I've been amazed at the performance you can get from Rust code that looks practically identical to the equivalent JavaScript.
- acqq 7y agoSee the C source I don’t find it less readable than Rust version. https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/mandelbrot-gcc-6.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- nicoburns 7y agoTo be honest I find both the fastest C and Rust answers ("C gcc #6" @ 1.64s and "Rust #6" @ 1.70s) highly unreadable. For me, "Rust #5" @ 1.98s is the first readable solution in the list, and seems comparable (code wise) with the Java, Python, etc implementations. ("C++ g++ #6" is also quite reasonable, but that's C++, not C).
- igouy 7y agoHow does "unreadable" relate to source code size for you? https://benchmarksgame-team.pages.debian.net/benchmarksgame/performance/mandelbrot-gz.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...