Dov Feldstern wrote: > Why do we need that structure at all? Given that our char_type is > 32-bits, and we don't use all 32, we could do something like the > following: the insets themselves could be stored in a hash table, > without storing their positions in that structure. At each position in > the paragraph where an inset appears, instead of just the META_INSET > character, we store an actual key into the hash table. (From the comment > on META_INSET I understand that we don't use any values above 0x20001 > --- which means that we have more than enough room for keys to as many > insets as we'd like in a single paragraph...). Then, there's no need of > keeping the insets structure in sync with the paragraph itself after > every insertion...
Note that if anything, this will make faster insertion and deletions, not lookups (the potential bottleneck that started this thread). I doubt that it has a real impact. Second point, I think a hash table is really not good because then iteration *in order* over insets of a paragraph becomes much worse than now (I think we use it in a few places). Now for a change, how about focusing on real bottlenecks? SCNR ;-) A/