C (14/207)

From:Allan Odgaard
Date:02 Dec 99 at 03:13:53
Subject:Re: Optimizing (Was: Re: Getting desperate!)

From: Allan Odgaard <Duff@DIKU.DK>

On 01-Dec-99, Nuno Trancoso wrote:

>> Changing printf(...) to fprintf(stdout, ...) and running 999 cycles took:
> Can you send the source to me ? I could do with an example :))

Search for "printf(" and replace it globally with "fprintf(stdout, ". That's
all I did!

> A guy once told me that C++ makes code bigger and slower. Anyone cares to
> comment on that?

Naturally a highlevel language cannot make the translated code better than that
of a lowlevel langauge. But with a highlevel language it's easier for the
programmer to sculpture his program, fine-tune algorithms, and indeed focus on
algorithms rather than implementation details. If you don't exploit this
new level of abstraction, then you probably shouldn't use the language, as a
more lowlevel language is likely to offer the same, but generate better code.
But this is certainly not the direction the computer industry is headed.

FYI HTMLview.mcc is written in C++ and makes heavy use of C++ features, but I
still haven't come across a faster 'program' with the same capabilities. So
in the end, it's not really your programming environment that counts, but how
you use it! Atleast this is my experience - but a person who just wants to
perform some simple task, like multiplying matrices, may not agree with me...

Regards Allan



URL: http://www.DIKU.dk/students/duff/


If God had intended Man to program,
we'd have been born with serial I/O ports.