You should perhaps also be aware that the values in a static array gets assigned to the array one element at a time. So

[J.Pietschmann]


That's an unpleasant surprise. I was always under the impression
statically initialized data was stored along with the string
constants, like in C. This means a generated perfect has table
wouldn't have much of an advantage over, let's say, a simple
binary tree loaded with the values in proper order so that the
tree becomes automatically balanced (without rotations like
rb-trees do).

I would guess that doing ~6 string compares to navigate the binary tree (with 148 color keywords) is slower than one string hash, ~1.2 int compares and one string compare. But I haven't measured it, so you might be well be right. Many keyword sets for other properties are much smaller and could perhaps benefit from a more suitable collection type.


It would make sense, however, to properly initialitze initial size
values for the various hashmaps currently used.

Indeed. Rehashing a HashMap is very fast tho, so I wouldn't expect a major speedup, but it all adds up.


regards,
finn



Reply via email to