I've had a look at the reports. Some of the recommended changes are stylistic and we will gradually make those changes. An example of this is avoiding enclosing a return value in parentheses e.g.. return (0). Another example is to do with avoiding redundant static, final etc. keywords in interface definition.
Among changes that relate to speed, some have to do with defining local variables outside loops. This can be done so long as it doesn't make the code illegible and hard to maintain. When local variables with limited scope are declared outside the block where they apply, it always creates new possibilities for bugs when the code is updated. Some of the recommended changes for removing function calls from the loop condition, like the one below are actually wrong. For example sometimes we loop over the elements of a vector to remove some elements. If the condition is precalculated to the initial size of the vector, then the loop would throw an exception when it reaches then end after some elements have been removed. In any case, where there was an issue of speed, we sometimes loop from the end of the vector to the beginning. Another point about the issues reported is that all packages are included as part of the same report. In fact only the org.hsqldb and org.hsqldb.lib are core HSQLDB packages. The org.hsqldb.test and org.hsqldb.util are other programs that have nothing to do with the efficiency of HSQLDB. In general, we would like to rely on dynamic usage reporting to improve speed. Many speed bottlenecks are also caused by the use of very general algorithms in some places that do not make the best choice for some operations, such as use of the best index for selection of records. Thanks again. Fred Toussi ----- Original Message ----- From: "fredt" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: 05 September 2002 11:41 Subject: Re: [Hsqldb-developers] HSQLDB 1.7.0 - Performance audit Hi Loic, Thanks for the effort. I hope you continue contributing to the project. >-1- >int size = Vector.size(); >for( int i = 0; i < size; i++ ) >{} > is better than > >for( int i = 0; i < Vector.size(); i++ ) >{} We have used the first form in all places that are performance sensitive. The second form is sometimes used in very infrequently-used methods. >Vector is a synchronized object, ArrayList do the same but is not >synchronized. Although a RDBMS must provide transaction isolation and thus >Vector might be useful to do that, I think that sometime, hsqldb could use >ArrayList objects instead >of Vector. This remark applies to Hashtable vs HashMap too. We are aware of the impact of synchronization. As a result David Nordahl has developed our implementations of List objects which do not use synchronization. Please download the 1.7.2 ALPHA B source package from the file download section to see the changes. Fred Toussi ------------------------------------------------------- This sf.net email is sponsored by: OSDN - Tired of that same old cell phone? Get a new here for FREE! https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 _______________________________________________ hsqldb-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hsqldb-developers ------------------------------------------------------- This sf.net email is sponsored by: OSDN - Tired of that same old cell phone? Get a new here for FREE! https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 _______________________________________________ hsqldb-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hsqldb-developers