Re: How do I get the address of (&) an object...
blmblm@myrealbox.com wrote On 04/11/07 08:17,:
In article <1176235470.297177@news1nwk>,
Eric Sosman <Eric.Sosman@Sun.COM> wrote:
me2 wrote On 04/10/07 15:01,:
On Tue, 10 Apr 2007 14:35:55 -0400, Eric Sosman wrote:
me2 wrote On 04/10/07 14:06,:
That is a lot of extra CPU cycles for no good reason other than to satisfy
the constraints of the language. Is there no other way ?
1) The extra CPU cycles are being spent not to "satisfy
the constraints of the language," but to compensate for the
inflexibility of the read64() method.
[ snip ]
You haven't mentioned your CPU's speed, but let's
assume that the clock frequency is at least 2.4GHz (my
three-year-old run-of-the-mill inexpensive home PC cycles
at 3GHz). That means you've got at least 40 CPU cycles
per received byte, more (or far more) if the CPU is faster
or if the USB device operates at a lower speed or at less
than full saturation.
In other words, there is no shortage of CPU power and
you are probably not justified in worrying about "a lot of
extra CPU cycles" being spent copying data from an unfriendly
to a friendly form.
Aren't you assuming here that there's not something else going
on in the computer that could make use of those CPU cycles that
aren't being used while the OP's program is waiting for I/O?
Maybe more often than not that's a safe assumption these days,
though.
No, I made no assumption about what else the machine
might be doing. Nor did I make any assumptions about how
many cycles the arrayCopy() calls might consume. My goal
was to establish a rough lower bound on the number of CPU
cycles available per byte of input, in order to determine
whether "a lot of extra CPU cycles" were likely to amount
to enough to bother worrying about. Since there appears
to be a plentiful supply of cycles, it is quite unlikely
that the impact of arrayCopy() will be a problem. If the
method burns a million cycles per byte copied there'll be
trouble, but does that seem likely?
The O.P. is fretting about "a lot of extra CPU cycles"
(without having made any attempt to substantiate "a lot"),
and I believe he is fretting needlessly. An analogy I've
used before: He's worrying about whether waxing his car
will improve fuel economy by making it slipperier, or hurt
fuel economy by adding weight.
--
Eric.Sosman@sun.com