3 ms·
Frankly, I would find it much easier to write the naive C version than this "moderately" optimized Python version in the article although I am much more familia
by fgeiger 4y ago
Frankly, I would find it much easier to write the naive C version than this "moderately" optimized Python version in the article although I am much more familiar with Python than with C.
- lorenzfx 4y agoEspecially reading and understanding the "moderately" optimized Python version is a lot harder than reading the C version. Also I really dislike python optimization tricks like `output = stdout.buffer.write`.
- bsder 4y agoI really hate these kinds of articles because they don't DO anything useful in the sample programs. Grab a web page and parse it for some data. Suddenly, C looks like trash. The network latency negates any speed advantage from C and the fact that C has to manually manage memory everywhere makes your C code look like a dumpster fire relative to the Python code. You can always pick a task that favors one language or the other. What people forget is that fast/slow ALSO includes "time to develop the code". If I can write the Python code in 1 hour and the C code in 10 hours, the code has to be a lot slower or be run a lot more times before the time wasted writing the C code pays off.
- BenjiWiebe 4y agoGood point. I love C, but I can't imagine doing web scraping in it. I pick up Ruby for that.
- bcrl 4y agoAnd if he'd applied the same optimizations to the C version, it would have trounced the optimized Python version. I really don't like it when authors unfairly penalize their "not preferred" solution -- it makes me feel like the entire time spent reading the article was nothing more than listening to pointless chest thumping by the author. The whole article was barely about the actual compiling of Python code.