Bug 39717 - very slow QVariant QWebFrame::evaluateJavaScript(const QString& scriptSource) method.
Summary: very slow QVariant QWebFrame::evaluateJavaScript(const QString& scriptSource)...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Nobody
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks:
 
Reported: 2010-05-26 03:06 PDT by stawel
Modified: 2014-02-03 03:50 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description stawel 2010-05-26 03:06:20 PDT
Hi all,

I noticed that the QWebFrame method evaluateJavaScript(const QString& scriptSource) is very slow.

consider this code:

class MyClass : public QWebFrame {

    void do() {
            QString script = QString(" \
                      var main = document.getElementById('main'); \
                      var newDivElement = document.createElement('div'); \
                      main.appendChild(newDivElement); ");

            //first loop execution time > 5 minutes  !!!!!
            for(int i=0;i<500;i++) 
                 evaluateJavaScript(script);

            //second loop execution time < 0.1 sec
            for(int i=0;i<500;i++) 
                 evaluateJavaScript(script + "false;");
    }
}

it looks like that the calculation of the result (JSC::Bindings::convertValueToQVariant)
is very slow.
maybe a lazy calculation would be better.

Best Regards
Comment 1 Sriram 2010-06-08 11:16:57 PDT
Seems to be a performance issue.  Should be picked up.
Comment 2 vincent 2013-07-28 19:17:02 PDT
as I see, the worst place of performance is tampering the html. eg.(JQUERY)
    $("<a class='savetolocal'>SAVE</a>").insertAfter(current);

i hope the qwebkit can offer some interface to extend the brower. like firefox's extension. user can excute extra script after loading page.
Comment 3 Jocelyn Turcotte 2014-02-03 03:50:45 PST
=== Bulk closing of Qt bugs ===

If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it.

If you believe that this is still an important QtWebKit bug, please fill a new report at https://bugreports.qt-project.org and add a link to this issue. See http://qt-project.org/wiki/ReportingBugsInQt for additional guidelines.