[nylug-talk] Popularity of Programming Languages
Steven Lembark
Mon May 22 18:52:53 EDT 2006
>> I still write C code, but it is always small pieces, in situations
where
>> we tried to do it in Java or Python and found that we were CPU
>> bottlenecked. Interestingly enough, because of how exceptional these
>> cases are, the usual anti-C rhetoric is irrelevant. ;)
>
> On the yum mailing list yesterday or so someone sent in some code he'd
> written to run through the yum (sqllite, really) indexes faster. The
> performance in C was about 3-4x faster (from memory, that's why I'm
> fudging the numbers in a big way). Now, this is only a difference of 2
> (C) sec to 6-8 (python) seconds on all of fedora core, but that's part
> of the benefit. C is still pretty close to assempler, so its faster. I
> think the biggest win is that unlike most compiled languages you don't
> have the load time of initializing the interpreter/runtime.
There is very little C I've seen in 10 years that
is faster in pratice than Perl. Most people write
most C using high-level lib's that put enough
overhead into the equation that they aren't writing
anything "close" to assembly anymore.
Most of the C anyone writes ends up in part of some
large, existing program. The startup time for large
programs is pretty consistent, be the progrem Perl
or Oracle. I've seen all sorts of wonderful "benchmarks"
showing how fast some item ran, only to have any real
improvement completely swamped by the startup,
initialization, connection, transfer, logging, command
line, and exit housekeeping of the full application.
In one case it took me about 3 hours to write and
test a tied-hash implementation in Perl for mapping
customer names to numbers in a high-volume shop. The
locals thanked my employer, and noted that they would
come up with a "real" application in something "fast"
like C. Six weeks later they brought out a nice, shiny
piece of C that ran a full 3% faster than my code --
saving almost 1.5 sec per day in a 6 hour run. Given the
improvement and project lifetime (5 years) they couldn't
even recover the cost of writing the C -- let alone
maintaining roughly 10x the amount of code.
If the 6-8 sec gain was in a tight loop that runs through
a zillion records per day, fine: it was probably worth the
effort. But how much code that anyone writes handles that
much throughput? Or even enough for a 100% improvement
to be worth the time developing really optimized C?
--
Steven Lembark 85-09 90th Street
Workhorse Computing Woodhaven, NY 11421
lembark at wrkhors.com +1 888 359 3508
More information about the nylug-talk
mailing list