Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-7723

Qt-Symbian port's sqrt() is very slow.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 4.6.1
    • 4.6.1
    • None
    • None
    • QT 4.6.1, Symbian ^2, Symbian ^3 environments.

    Description

      Qt's port to symbian uses S60's OpenC libm math library for all mathematical operations. In particular sqrt() is extremely slow.

      We are prototyping using QWebview along with the use of CSS 3 gradient colors. The implementation of gradient calculations in QtGui relies heavily on sqrt(). In our profiling, we have found that sqrt() operations account for over 80% of the execution time. For example fetchRadialGradient() in qDrawhelper.cpp, there is a tight while loop which calls qSafeSqrt() for each pixel.

      Firstly, the use of OpenC's sqrt() should be examined as it calls the sqrt(double) version insead of sqrt(float). The QT sqrt calls are wrapped to qSqrt() in corelib's math.h.

      Secondly, we would like to propose the usage of a fast sqrt calulation. [to speed up execution at the loss of precision especially for mobile cases]. If this can be configurable for math intensive calculations such as gradients Gui performance will improve significantly. [Also making the sqrt function inline is 20-30% faster than calling a separate routine]

      A well known implementation of inverse newton's sqrt() can be found at these locations:
      http://www.azillionmonkeys.com/qed/sqroot.html (Double)
      http://en.wikipedia.org/wiki/Fast_inverse_square_root (Float)

      We have prototyped this solution with good results. View rendering times dropped from 2.5s to 300ms (~10x increase)

      Attachments

        1. 0001-Optimized-radial-gradients-on-Symbian-by-using-fast-.patch
          2 kB
        2. main.cpp
          1 kB
        3. qmath.h
          5 kB
        4. qmath.h
          5 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              rodal Samuel Rødal
              david.leong@nokia.com David Leong
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes