db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dyre.Tjeldv...@Sun.COM
Subject ArrayInputStream and performance
Date Thu, 23 Nov 2006 10:13:55 GMT

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

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)
 			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...


View raw message