QT's math library performance on Ios/Android

  • Just wondering if QT's math library for both ios and Android is written to take advantage of the hardware's math capabilities. We know that a software implemented math library is about 10 times slower on IOS as compared to Apple's library (GLKMath) written to take advantage of the ARM processor. This is important to us as a 3D developer.

    Thanks in advance.

  • Lifetime Qt Champion


    That's the kind of question you should ask on the mailing list. You'll find there Qt's developers/maintainers (this forum is more user oriented)

  • Hi, what math lib are you talking about?
    QtMath has just some function wrappers for the default math.h stuff and maybe qFastSin and qFastCos, so I have no idea if the default math.h function take advantage of the ARM CPU or any GPU features, possibly not :D

  • I am looking at mainly 3D math functions such as multiplying matrices, vector manipulation (vec2, 3, and 4), Quaterenions.

  • I think they are just using the default math functions, you can just look at the source code and see for yourself :)
    e.g. if you installed it the source code is available at Qt/5.2.1/Src/qtbase/src/gui/math3d
    void QVector3D::normalize()
    // Need some extra precision if the length is very small.
    double len = double(xp) * double(xp) +
    double(yp) * double(yp) +
    double(zp) * double(zp);
    if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))

    len = sqrt(len);
    xp = float(double(xp) / len);
    yp = float(double(yp) / len);
    zp = float(double(zp) / len);

    just using the default sqrt form math.h

Log in to reply