I have noticed that two methods, setPosition(int) and setLimit(int)
seem to use more CPU than what I find "reasonable" given what they're
supposed to do. Together they use 4.5% of user CPU and 1.5% of system
CPU.
Looking closer at what each method does, it seems like a fair amount
of the CPU is on argument/consistency checking.
For setPosition(int) it seems simple to replace the checking with
an ASSERT, but in setLimit(int) a failed check will cause 'start', 'end'
and 'position' to be set to 0 before an exception is thrown:
start = position;
end = position + length;
if (end <= pageData.length)
{
return;
}
else
{
start = end = position = 0;
throw new EOFException();
}
Does anybody know if there is code that catches this exception and
that relies on these variables being set to 0?
With both checks replaced by ASSERTs I was able to to run all the
junit tests without seeing any problems...
--
dt