TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: DARIN MCBRIDE
from: JERRY COFFIN
date: 1997-07-28 09:52:00
subject: template hell?

On (26 Jul 97) Darin Mcbride wrote to Kevin Campbell...
 KC> Well I've already got a huge linked-list class (bi-directional,
 KC> start/end optimisation, the works). Only problem with moving the
 KC> the STL would be the lack of any source code (at least on my
 KC> version). As
 DM> Minor details.  ;-)
I'm hard put to agree that lack of source code is a minor detail.
However, I'm interested in knowing exactly how they're distributing STL
without source code.  Nearly all versions I've seen are distributed
primarily as a set of headers.  There's (presently) little or no other
reasonably portable method of handling templated code.  Some specific
compilers have ways of handling it, but most still need source code
around in some form or other to work correctly.
 DM> The STL classes are generally within 2-5% of the speed of hand-coded
 DM> C/C++ (non-templated) libraries.
Not in my experience.  This obviously depends somewhat upon the specific
implementation of STL you work with, as somebody can write an
arbitrarily poor implementation.  However, my own experience has been
that the variation has been much wider than the numbers above suggest.
Some of this depends on exactly what you compare though.  For instance,
STL uses one ownership policy, which can involve creating and destroying
quite a few objects.  Many situations don't really require that, and can
gain _considerable_ speed by avoiding it.  (I've got one that more than
tripled in speed when STL was replaced with more specialized code.
However, STL is nearly always good enough to at least use for the
prototype, and is only worth replacing when you find that it's a cause
of a major bottleneck.  This was the case with the code mentioned above,
but certainly is NOT the case in LOTS of other code I've dealt with.
    Later,
    Jerry.
... The Universe is a figment of its own imagination.
--- PPoint 1.90
---------------
* Origin: Point Pointedly Pointless (1:128/166.5)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.