[Development] Container benchmark was HEADS UP: Don't use QList, use Q_DECLARE_TYPEINFO

Marc Mutz marc.mutz at kdab.com
Fri Jul 17 11:09:30 CEST 2015


On Thursday 16 July 2015 23:09:55 Gunnar Roth wrote:
> > About QFastHash: that is WIP. It's the very rudimentary beginnings of an
> > open- addressing hash container (a hash container using consecutive
> > memory, not nodes).
> >
> > 
> 
> What was the idea behind it? Is so much slower than any other that I can
> just see why anyone should want to have this? What is the advantage?

The idea is to implement https://en.wikipedia.org/wiki/Open_addressing with 
linear probing, which theoretically should be more cache friendly than a node-
based container (less memory overhead, cache-friendly probing).

But I separated key and values into different containers, so even at optimum, 
you get two cache hits instead of one with QHash. As Ossi pointed out in the 
review, that's probably a pessimisation unless you have a very loaded 
container. Likewise, Optional<T>, required to mark entries as empty or 
occupied, isn't optimized at all. all but doubling the space required for most 
keys because of the pairing with a bool.

As I said, it's WIP.

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts



More information about the Development mailing list