Re: sorting the input
On Sep 24, 4:10 pm, Hendrik Schober <spamt...@gmx.de> wrote:
Jorgen Grahn wrote:
On Fri, 19 Sep 2008 13:30:52 -0700 (PDT), James Kanze <james.ka...@gmai=
l.com> wrote:
On Sep 19, 12:55 pm, Jorgen Grahn
<grahn+n...@snipabacken.se> wrote:
On Wed, 10 Sep 2008 17:06:16 +0500, arnuld
<sunr...@invalid.address> wrote:
....
For me it's very likely also the first time I disagree with
James. I have seen someone debugging and profiling an
application for a week to no avail, until he was told to
replace 'std::endl' by '\n', which made the code he was
trying to speed up (which wrote big files) ten times faster
and ended all his performance woes.
Which is stupid too. *IF* you have a performance problem, then
it should be an obvious consideration, along the lines of making
a function inline.
If you know what you're doing, I wouldn't even oppose using '\n'
from the start in a tight loop; although it is premature
optimization, there are worse things you can do. But for most
people, as long as there is no performance problem, std::endl is
the way to go.
I've been hammering "use '\n' unless you /want/ to flush"
into quiet a few generations of students since...
Since when? That sounds like the performance problem mentionned
above took place a long time ago. Which means that the
performance difference may have (probably has) become less.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34