mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-24 17:09:41 +00:00
6bbd88accf
This fixes two performance issues and improves the performance of TextMetrics::redoParagraph by 15% in a workload that uses the cache a lot. The difference will be much less when the cache is not used much. 1/ repetion of the hash code computation The code if (cache.contains(key)) result = cache[key]: is not efficient, since qHash(key) has to be computed twice. To fix this a new Cache::object_str() method is added, which allows if (auto * obj = cache.object(key)) result = *obj; 2/ code of has code computation Instead of using a verbose string that is complicated to build as key, new key structs BreakAtKey and TextLayoutKey are introduced, along with the relevant qHash() implementation.