G
gwowen
What I did find of course, is that huge programs tend to
trash around a lot jumping from one small method to the
next one...
THAT is surely a common observation.
Yup. That sounds about right.
What I did find of course, is that huge programs tend to
trash around a lot jumping from one small method to the
next one...
THAT is surely a common observation.
Leigh Johnston said:Remember: premature optimization is the root of all evil.
Stefan said:The whole point of C++ is premature optimization
The whole point of C++ is premature optimization, otherwise
one would use a programming language that is more safe,
simple, portable, and powerful.
jacob said:Yes, you are right in principle. It is conceivable that a huge
program uses only a small fraction of its executable foot print
and all of it fits in the cache.
It is also conceivable that a program has a huge footprint but
it has almost no jumps so that its cache misses are exceptionally
low because when code is loaded all of it is used in highly
efficient loops.
And there could be more of those situations.
ALl I can tell you is that in my experience both the above
cases aren't found "in nature"...
What I did find of course, is that huge programs tend to
trash around a lot jumping from one small method to the
next one...
THAT is surely a common observation.
Rui Maciel said:Why do you believe that "the whole point of C++ is premature
optimization"?
I believe you didn't quite understood it. The main point, which Belady's
anomaly demonstrates, is that there isn't necessarily a direct correlation
between how much cache a program takes up and the number of cache misses.
If it isn't possible to assume a direct correlation between how much cache
a program takes up and the number of cache misses then it isn't possible
to claim that a specific variation in a program's size has a specific
impact on how fast a program is ran. If the subject being discussed is
the relation between a program's size and the influence that size may have
on how fast that program runs, particularly due to the number of cache
misses it generates, then it is obviously relevant.
Rui Maciel
The whole point of C++ is premature optimization, otherwise
one would use a programming language that is more safe,
simple, portable, and powerful.
I leave it up to you to decide whether this means that
C++ is the root of all evil.
Design decision in C++ are usually decided in favor of
run-time efficiency.
For example, Java has decided to check array indices
at runtime, C++ not to.
»Learning C++ is equivalent to studying to be a NASA
test pilot. Its incredibly fast and effective, but takes
years to master the arcania and things tend to blowup in
your face if you're not very careful.«
Shinji Ikari
»I would rather compare it to learning how to drive a
racecar: yes, it can be fast. Most people tend to drive
it off track right away. Some people die in it.«
Matthias Blume
OOP: bind as /late/ as possible
C++: bind as /early/ as possible (generic programming)
Since this optimization is /always/ done, by pure /choice of
the language/, it can be called premature.
Stefan Ram said:»Learning C++ is equivalent to studying to be a NASA
test pilot. Its incredibly fast and effective, but takes
years to master the arcania and things tend to blowup in
your face if you're not very careful.«
Shinji Ikari
»I would rather compare it to learning how to drive a
racecar: yes, it can be fast. Most people tend to drive
it off track right away. Some people die in it.«
Matthias Blume
Design decision in C++ are usually decided in favor of
run-time efficiency.
For example, Java has decided to check array indices
at runtime, C++ not to.
OOP: bind as /late/ as possible
C++: bind as /early/ as possible (generic programming)
Since this optimization is /always/ done,
Design decision in C++ are usually decided in favor of
run-time efficiency.
For example, Java has decided to check array indices
at runtime, C++ not to.
»Learning C++ is equivalent to studying to be a NASA
test pilot. Its incredibly fast and effective, but takes
years to master the arcania and things tend to blowup in
your face if you're not very careful.«
Shinji Ikari
»I would rather compare it to learning how to drive a
racecar: yes, it can be fast. Most people tend to drive
it off track right away. Some people die in it.«
Matthias Blume
OOP: bind as /late/ as possible
C++: bind as /early/ as possible (generic programming)
Since this optimization is /always/ done, by pure /choice of
the language/, it can be called premature.
»Learning C++ is equivalent to studying to be a NASA
test pilot. Its incredibly fast and effective, but takes
years to master the arcania and things tend to blowup in
your face if you're not very careful.«
Shinji Ikari
The whole point of C++ is not premature optimization. One of its major
design goals, inherited from C, is to be a portable general purpose
assembly language.
Part of that design goal is indeed optimization. If
that is premature depends on the particular program. While I'm always
a fan of measuring first, optimizing second, that maxim has its
limits. One is not going to write an OS in Ruby just to profile it and
rewrite the important parts in C.
Writing software just doesn't work
that way. Sometimes choosing things up front for performance
considerations is /not/ premature. A classic example is you have to
decide pretty early if you want a single threaded, multi-threaded, or
distributed, application as that will have big impacts on your design
and code.
Is it explicitly forbidden by the standard ?
I thought it was up to the compiler to provide it or not. IIRC Visual
has the option.
Java doesn't let you the choice.
....
Since this optimization is /always/ done, by pure /choice of
the language/, it can be called premature.
One day I'm going to have to write a paper called
"The phrase 'premature optimization' considered harmful" ...
Really? What does .at() do?
Doesn't look like array index to me.
One day I'm going to have to write a paper called
"The phrase 'premature optimization' considered harmful" ...
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.