Jean-Marc Lasgouttes wrote:
"Bo" == Bo Peng <[EMAIL PROTECTED]> writes:

What about using short ints instead of ints?
Bo> I do not know what exactly is going on here, but if there are a
Bo> lot of duplicates, std::map should help.

A std::map is what we had, but a vector is faster.
Of course the downside is that it costs much more memory. The question
is how to mitigate this. I see

Quite frankly, the speed with the map based solution was quite OK on Windows and Macs. It might show in some profile but the number is negligible. There are much bigger cpu eater than that. I reckon that the hash based solution would be more than enough and easy to implement.


* using short ints : this means that the cache struct uses 6 bytes
  instead of 12 (unless alignement comes into play)

* using an array of pointers to cache. Most entries will use 4 bytes,
and some will need 4+12 (or 4+6) bytes.
* something more complicated like an array of 256 pointers to arrays
  of cache struct. There we should see much bigger gains, and the
  price in performance might be negligible.

* using a QHash as Abdel proposes.

Personally, using 20M of memory just because we can is not acceptable.

Well, this is 20Mo with the UserGuide loaded which contains an awful lot of different fonts. I expect much lower number for a "normal" document.

Abdel.

Reply via email to