On Thursday 16 July 2015 23:09:55 Gunnar Roth wrote:
> > QHash is slower than std::unordered because std::hash<double> is inline
> > and  qHash(double) is out-of-line.
> 
> May I ask why? 
> Is this valid for all qHash()?

Commit c0791ac76ec7cfdc3945efa67a6f72ee3623413c

    Add qHash() overloads for floating-point types

    Implemented out-of-line to avoid potential FP-comparison warnings, as well
    as to be able to use the file-static hash() functions, which gets inlined
    unlike qHashBits(), which cannot be.
    
It was a tradeoff between a faster inlining into your code and a faster hashing 
algorithm.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to