neo4j/community — pull request #481 by jexp (2012-05-02 02:18:02+00:00)
Title: improved property-encoding performance for short arrays and short strings

Short-Array:

I mostly changed the single element methods to array based methods which always work on a whole array which they cast internally to the correct type and so don't need to use reflection
Also the ShortArray type lookup is now done via an lookup-array
I reversed the highest-bit detection so that it starts from the beginning
Zero length arrays are shared constants.

Short-Strings:

I replaced with EnumSet's which are very expensive with a simple bit-mask
I replaced the switch statement with two lookup arrays, one contains the new data value the other the bitmask for the not applicable encoders,
Some minor loop optimizations (pull out length variables)
Some refactoring (extracting methods), introduced some constants
lookup by encoding now via lookup array and not switch statement

Changed PropertyBlock to use isEmpty() instead of size() == 0 which is implemented more efficiently in Linked-List, tried ArrayList but its iterator sucks.
Changed size calculation loop to lookup as it runs on an array list whose iterator is slower in java6 than java7