Re: perfomance question about bool variables in cxx
From: Bob Gezelter (gezelter_at_rlgsc.com)
Date: 07/22/05
- Next message: William Webb: "Re: Exabyte 220 robot blues."
- Previous message: Stanley F. Quayle: "Re: Modbus TCP for VMS?"
- In reply to: Larry Kilgallen: "Re: perfomance question about bool variables in cxx"
- Next in thread: Larry Kilgallen: "Re: perfomance question about bool variables in cxx"
- Reply: Larry Kilgallen: "Re: perfomance question about bool variables in cxx"
- Reply: Klaus-D. Bohn: "Re: perfomance question about bool variables in cxx"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 22 Jul 2005 11:50:34 -0700
Larry,
With all due respect, I disagree with your explanation. If Klaus were
dealing with a large array of booleans, I would agree with you to the
extent that stepping through 8 times as much data (quadwords instead of
bytes) would generate inefficiencies.
In this case, the posted code generates a large number (42,949,672 to
be precise) of references to a single variable (quadword or byte,
respectively). In the case of the Alpha, Itanium, and almost all VAX
models, presuming that the data is naturally aligned by the compiler,
each reference should be a single cache or memory reference.
However, this simple experiment also illustrates the difficulties and
challenges of benchmarking.
- The compiler will, in many cases, optimize out the invariant
assignment code in the loop. Thus, with the correct compiler switches
used, the nearly 43 million iterations of the loop will be optimized to
a single instruction, executed exactly once.
- The fine level timing of this code, if it executes even a significant
number of iterations will be influenced by the other activity on the
CPU. Any event which affects cache hit rate, will effect the overall
performance of the code. To do this experiment effectively requires a
deeper analysis, and many test runs to get a significant certainty that
the numbers are not being influenced by random events. Science is
reproduceable, happenstance is not.
- There is a certain amount of processing that is not attributable to
the actual code under test. This includes image activation, the jacket
code in the test program, and image rundown. How much this is needs to
be computed, and subtracted from the test results to obtain an accurate
result. This overhead is the computational equivalent of the "tare
weight", the weight of an empty container when placed on a scale.
My apologies for running on a bit. I hope that this commentary is
helpful.
- Bob Gezelter, http://www.rlgsc.com
- Next message: William Webb: "Re: Exabyte 220 robot blues."
- Previous message: Stanley F. Quayle: "Re: Modbus TCP for VMS?"
- In reply to: Larry Kilgallen: "Re: perfomance question about bool variables in cxx"
- Next in thread: Larry Kilgallen: "Re: perfomance question about bool variables in cxx"
- Reply: Larry Kilgallen: "Re: perfomance question about bool variables in cxx"
- Reply: Klaus-D. Bohn: "Re: perfomance question about bool variables in cxx"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|