Well, that true ...but the current length is hold as 15-bit integer. The highest bit decides whether it's an index in a HashMap or not.
As I said we could increase the length to 31-bit but that gives 2 additional bytes per character event.
...
Let's not discuss this to death. I'll fix it :)
Minor suggestion. >32k events do not happen everyday, but <32k events do, a lot. So, instead of adding size to the <32k events, it's better to add some size to >32k events. What I mean is:
1) Leave length as it is, 2 bytes.
2) Have one value reserved, say 0xFFFF
3) In case of >32k event, write first 0xFFFF, and then 32 bit length.
This way, old events do not grow larger, only large event header increases - becames larger on 4 bytes.
Vadim