Here are few of my ideas about how some classes can be made a lot
faster. Maybe I'll implement them, but if not I would like to share
them.

java.lang.Character
I was already talking about it - work directly on array, without
CharAttr creation (it is already done in my version) and create
compression tables more loosely - do not compress blocks that are too
short (like 2-5 lengths) - they should be merged with surrounding
explicit info (for better preformance in findBlock)

java.lang.Hashtable
Instead of duplicating sun way of table of pointers to linkedlists, it
might be better to use direct tables, with cubic or ^3 search. It has
the bonus of creating a lot less objects, it is faster on hashcode hit
by one dereference, shows a lot greater locality, is faster on
operations like contains or containsValue (dereference and locality)
etc.
Similar thing could be done for HashMap, but special care would have to
be taken for null keys - probably by replacing them to some internal
pointer to special object.

java.lang.BitSet
It might be interesting to implement BitSet to use array of ints instead
of array of longs. Of course sun have created API of bitset heavily
based on their internal representation - but only serialization and
hashcode computation would require hackery. Such BitSet would work a lot
faster on 32-bit CPUs. I wonder if it would be possible/reasonable to
distribute two versions - and place one that will work faster for target
machine (of course both of them would work on very platform).

Artur

Reply via email to