Note that there are some explanatory texts on larger screens.

plurals
  1. POQT: Javascript execution slow (unless I log to the console)
    primarykey
    data
    text
    <p>In QT 4.8.4 I have some arbitrary Javascript being executed via a callback in the c++:</p> <pre><code>myWebElement-&gt;evaluateJavaScript( myScript ); </code></pre> <p>Now, the test script was:</p> <pre><code>$(this).css('border', 'solid 10px #000') </code></pre> <p>which worked, but it took a few seconds to run, and ran up the CPU <strong>100%</strong>.</p> <p>Then while testing I added "; console.log('X')" while debugging the script to see pinpoint the hangup... And it executed instantly!</p> <p>I've found that as long as I'm logging to the console, the scripts work efficiently as expected. As soon as I remove the console logging the performance slows to a crawl. It doesn't matter if I log directly in the script, or add the log in the C++.</p> <p>Any ideas? I'd hate to have a hack like below floating around in my program.</p> <pre><code>myWebElement-&gt;evaluateJavaScript( myScript + "; console.log('X')" ); </code></pre> <p><strong>UPDATE:</strong></p> <p>Looks like this bug is affected by the number of elements on the page. There's a table, in instances where there's only one or two rows there's no CPU run-up. When there's 600 rows there's several seconds of maxed-out CPU usage. Again though, as soon as there's a console.log command on the end there's no CPU run-up even with 600 rows.</p> <p>(also added version info to the question)</p> <p><strong>UPDATE 2:</strong></p> <p>After testing, I don't need to pass anything into the console for the hack to work, I don't even need to call log. I can append "; console;" to the script and it will still work instantly. I've also tested adding a return statement to the end, which didn't work.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload