top | item 14415152

(no title)

ajbonkoski | 8 years ago

I don't get articles like this.. they seem to miss the bigger point.

Typically there are two modes in my computing: (1) Scripting / Command-line get stuff done and throw-away, and (2) Serious applications that are heavily used, need to process lots of data and be as fast as possible (e.g. processing millions of files like this one where the algorithm constant factor really matters).

In case 1: Hack something together with shell or python and get an answer. If it takes 100-1000x of the equivalent C program, than fine..

In case 2: Custom special purpose C or C++ code

I really don't understand the middle ground here. The equivalent C version that does the same job runs in ~250 millis on my slow Yoga 2 Pro laptop. Total line count 83 of pure C (no other libraries).

Is it "elegant"? Depends who you ask.. But, at the end of the day, "elegant" doesn't pay the bills..

discuss

order

bionsuba|8 years ago

This is a nice sentiment, but this rarely plays out in practice in my experience.

People use Python all the time to manipulate data sets >= 100G in size despite its speed failings at that size. Why? Because Pandas is just so damn convenient. It would take me a grand total of 30 seconds to write Pandas code which read a TSV and gave me the sum of two multiplied together columns grouped by the day of a timestamp column. Doing that in C would take several orders of magnitude more time.

It's an optimization of people's time problem. You could probably spend several hours (or days) writing a C program for a specific problem. But if you can spend only 40% of the time writing the program and have it only 20% slower, then that's a definite win (these numbers are just an example).

acehreli|8 years ago

It's one of the points of this article that you don't need those two modes with D. Scripting and custom code in the same language is possible but it's still an alien concept.

mhh__|8 years ago

The point here is that you can write both the python and the C version in the same language. Your C version, excluding the preprocessor, might already compile as a D program anyway.

colechristensen|8 years ago

I'd expect a significant amount of the shell code I cobble together to run faster than anything I could write in a more advanced programming language.