>"Daniel John Debrunner" wrote: >I think it's actually fairly easy to test this. Write really simple >tests using direct creation of SQLIntegers, completely outside of the >engine. Work on plus, write a simple additon using plus that simulates >what the engine does, execute one million additions using
>1) references through NumberDataValue >2) referenecs through NumberDataType >3+) various modified plus() methods as descibed in the type's package.html. Initial tests (all tests pass non-null arguments) give these typical results: 1 Million iterations Total 'native int' time: [0] Total NumberDataValue time: [140] Total SQLInteger time: [47] Total DataValueDescriptor time: [141] Total int time: [47] 10 Million iterations Total 'native int' time: [47] Total NumberDataValue time: [1281] Total SQLInteger time: [547] Total DataValueDescriptor time: [1234] Total int time: [344] 'native int' is just adding two 'int' values together in java - no method call involved. 'NumberDataValue' is the existing 'plus' function. 'SQLInteger' calls 'plus1' which defines all parameters and the return as SQLInteger. 'DataValueDescriptor' calls 'plus2' which defines all parameters and the return as DataValueDescriptor. (The NumberDataValue interface extends the DataValueDescriptor interface) 'int' calls 'plus3' which defines all parameters and the return as int. Since ints can't be null much of the method was removed. Not much difference between NumberDataValue and DataValueDescriptor which are 2-3 times slower than SQLInteger. SQLInteger has pretty low overhead given that it is an Object and performs all of the 'null' and overflow checking. Still to do: tests using methods defined on 'self' per Dan's suggestion.
SQLInteger.java
Description: Binary data
derbytest.java
Description: Binary data