[rescue] Mozilla Firefox
Peter Corlett
abuse at cabal.org.uk
Fri Apr 23 07:51:20 CDT 2004
Dave McGuire <mcguire at neurotica.com> wrote:
[...]
> Eh...I'd sure like to hear more about this. Especially something like,
> what instruction on a SPARC, for example, is involved in "new"-ing an
> object. ;)
Well, it depends on the particular type of new, and I don't know SPARC
assembler, sorry :p
Any object where you care about performance should have a
trivialconstructor. So once the optimiser has been at it, it'd boil down to
a call to malloc() (or some function of similar complexity) and then
initialising data in the memory allocated.
You picked a bad example for your claim, C++ constructors essentially have
zero cost. You have to initialise data in C, after all...
You should have picked on templates that aren't inlined. Now *that* is the
major path to code bloat.
>> In C++, you lose some by having an extra layer of indirection sometimes,
>> you win by having a Big Bastard Optimiser on the job.
> Again, band-aiding to massage something into an architecture in which it
> does not fit.
Do your C program never use pointers to functions and then call those?
That's pretty much all that's involved in a virtual function call.
>> Sometimes people take the idea of code reuse a little *too* far, and
>> write code that is "reusable", but not actually usable for anything.
> Well that's a big part of the problem...it *is* usable, if you have a
> 2+GHz processor and 1+GB of RAM! And since a lot of these "programmers"
> have never done any other types of projects or worked on any other type of
> system, they think it's normal for a weather-display widget to eat 23MB.
I was actually thinking more of an object/library that is heavily
overengineered but doesn't really provide some basic requirements, or uses
so many classes and objects in the internal implementation in the pursuit of
perfection that performance suffers. (Not that I am in any way innocent
here.)
--
Contrary to general belief, I do not believe that friends are necessarily the
people you like best, they are merely the people who got there first.
- Sir Peter Ustinov
More information about the rescue
mailing list