C is fastest (was: McMaster University Creates Open Source eHealth Records System)

Christopher Browne cbbrowne-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Wed Oct 14 19:49:59 UTC 2009


On Wed, Oct 14, 2009 at 10:35 AM, Lennart Sorensen
<lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org> wrote:
> Well researchers don't get everything right.  Garbage collection sounds
> like a good idea, until real applications have to be written.  The number
> of java applications that like to consume 500MB or 1GB of ram to do
> almost nothing is rediculous.  Maybe the garbage collection simply isn't
> working because the programmers are doing a terrible job.  Either way
> it is encouraging developers to not think about resources at all.
> Clearly that isn't working.

I have seen *terrible* things happen with this, but disagree that it's
the fault of garbage collection itself.

Case in point...  We used to use a replication system called eRserver,
implemented in Java.

The programmer had the NON-bright idea of drawing all the queries he
was submitting into memory, so that the Java process would bloat up in
size in keeping with how much data was getting synchronized.

This was totally unnecessary - each SQL statement getting generated
and submitted could get discarded immediately upon having been
generated.

Garbage collection hid from that developer that the queries were
getting held up in memory; he never noticed (possibly ever).

This wasn't a Java problem, or a garbage collection problem; all of
that is a red herring.

If he was allocating strings in C using malloc(), or using "new" in
C++, THE SAME PROBLEM WOULD HAVE ARISEN, and for fairly much the same
reasons.

The problem isn't that "garbage collection is bad," it is that
programmers who don't pay enough attention to their systems to have
either:
 a) interest, or
 b) ability
to profile and address the bottlenecks of the systems that they build
shouldn't be let near anything "going to production."

The visible presence of malloc() in C throws these problems in the C
programmer's face; most of the time, I'd prefer to NOT have those
details thrown in my face.  I'd rather profile + fix when there
actually is a problem.

Otherwise, we're heading back down the road towards "better write
everything in assembly language, because otherwise it might not all be
optimized!"

There are cases where that's appropriate (e.g. - embedded), but not everywhere.
-- 
http://linuxfinances.info/info/linuxdistributions.html
Stephen Leacock  - "I detest life-insurance agents: they always argue
that I shall some day die, which is not so." -
http://www.brainyquote.com/quotes/authors/s/stephen_leacock.html
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list