Lars Gullik Bjønnes wrote:
> | Note that there is room for improvement in our fontcache which uses a
> | std::map. A vector will probably not use too much memory (for 8bit
> | fonts) and be much faster.
>
> It will not be 8bit fonts.
>
> We should use a unordered_map and fallback to map if that is not
> available.
Here new numbers, better numbers because I don't use QTimer
any more but clock() which gives better results.
There are to cases: filling cash (scrolling down)
and reading (down, timer reset and then up+down):
Filling Reading
Guide Tutorial Tutorial
int[256] 11 8 5
QHash 12 14 9
std::map 16 16 10
Qt 75 70 70
in % of drawText, lesser is better,
error +- 3-6 (?)
And the result: all is better than not caching.
The fastest is int[256], who wonders?
QHash is a little bit faster than std::map.
I wonder about Qt, seems they have a worse cache.
Peter