[webkit-qt] Qtwebkit 5.212 setuserstylesheet() is taking 7seconds time first time on startup

Ramakanth Kesireddy rama.kesi at gmail.com
Thu Dec 10 21:29:55 PST 2020


Creation of QWebPage takes time when we add logs in the Qtwebkit
source..Not sure how it is different from Qt4.8 with the same UiApp sources
though architecture is modified or made more modular. Are there any
QWebSettings that could be set to disable any or any thoughts on the same
are much appreciated..



On Wed, 9 Dec, 2020, 12:41 Ramakanth Kesireddy, <rama.kesi at gmail.com> wrote:

> Hello Konstantin,
>
> Please find the feedback of the ones that had been asked to try out:
>
> First, is "delay" you are talking about equal to execution time of
> setUserStyleSheet? You can measure it simply by putting QElapsedTimer
> before call and printing its value afterwards.
>
> My first guess about this "delay" is that it is caused by complex layout
> computation. However it's hard to guess why 4.8 behavior is different
> without profiling.
> Did you try to do any profiling of what happens inside setUserStyleSheet?
> Does execution time of setUserStyleSheet depend on page or stylesheet you
> are trying to load?
>
> Feedback:On profiling with QElapsedTimer, it is found
> that m_WebView->page() took 11368 ms. So the delay is not due to stylesheet
> that is being loaded or html content.
> There is no baseUrl being passed to the setHtml().
>
> Checking with further profiling of other functions being invoked from
> QWebpage constructor to figure out the exact function causing the delay.
>
> Do you have any suggestions incase there are any known patches
> for the first time delay due to initializations ?
> Atleast I couldnot find any known issues in the qtwebkit github issues
> related to the same.
>
> Using Qt WebKit 5.212 Alpha4 release through yocto build on top of Qt
> 5.6.3 binaries.
> Am not sure if the below patch in yocto build makes any difference for the
> first time load issue:-
>
> Source/JavaScriptCore/generate-bytecode-files | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Source/JavaScriptCore/generate-bytecode-files
> b/Source/JavaScriptCore/generate-bytecode-files
> index c5dab429c..d745b3eb2 100644
> --- a/Source/JavaScriptCore/generate-bytecode-files
> +++ b/Source/JavaScriptCore/generate-bytecode-files
> @@ -115,6 +115,7 @@ if __name__ == "__main__":
>
>      bytecodeJSONFile = args[0]
>      bytecodeFile = openOrExit(bytecodeJSONFile, "rb")
> +    bytecodeFileDecode = openOrExit(bytecodeJSONFile, "r")
>      sha1Hash = hashFile(bytecodeFile)
>
>      hFileHashString = "// SHA1Hash: {0}\n".format(sha1Hash)
> @@ -163,7 +164,7 @@ if __name__ == "__main__":
>          initBytecodesFile = openOrExit(initASMFileName, "w")
>
>      try:
> -        bytecodeSections = json.load(bytecodeFile, encoding = "utf-8")
> +        bytecodeSections = json.load(bytecodeFileDecode)
>      except:
>          print("Unexpected error parsing {0}:
> {1}".format(bytecodeJSONFile, sys.exc_info()))
>
> --
> 2.27.0
>
> Thanks a lot for your support.
>
> Best Regards,
> Ramakanth
> On Fri, Dec 4, 2020 at 11:36 PM Konstantin Tokarev <annulen at yandex.ru>
> wrote:
>
>>
>>
>> 04.12.2020, 10:36, "Ramakanth Kesireddy" <rama.kesi at gmail.com>:
>> > Hello Konstantin,
>> >
>> > Thanks for the details.
>> >
>> > Also the same UiApp setuserstylesheet codes work for Qt 4.8 based
>> QtWebKit 2.3.4 without any delay first time.
>> > Do you think of any potential changes in QtWebkit 5.212 Alpha4 that
>> could cause the first time load issue of user stylesheet?
>>
>> First, is "delay" you are talking about equal to execution time of
>> setUserStyleSheet? You can measure it simply by putting QElapsedTimer
>> before call and printing its value afterwards.
>>
>> My first guess about this "delay" is that it is caused by complex layout
>> computation. However it's hard to guess why 4.8 behavior is different
>> without profiling.
>> Did you try to do any profiling of what happens inside setUserStyleSheet?
>> Does execution time of setUserStyleSheet depend on page or stylesheet you
>> are trying to load?
>>
>> >
>> > Best Regards,
>> > Ramakanth
>> >
>> > On Thu, Dec 3, 2020 at 10:26 PM Konstantin Tokarev <annulen at yandex.ru>
>> wrote:
>> >> 03.12.2020, 19:40, "Ramakanth Kesireddy" <rama.kesi at gmail.com>:
>> >>> Ok Thanks for your mail.Shall check and update further.
>> >>> Is it by design QWebSettings is not thread safe or any means to make
>> thread safe?
>> >>
>> >> WebCore by design is not thread safe. QWebView and all other classes
>> from QtWebKitWidgets module use WebCore directly and so aren't thread safe
>> too. You must call them from the same thread QWebView was created (and it
>> should better be main GUI thread, i.e. where QApplication is created).
>> >>
>> >> For comparison, QML API uses multi-process architecture so WebCore is
>> used in a background process and minimizes blocking of GUI process (i.e.
>> your application). Though that API is still not thread safe respective to
>> threads in GUI process (though it might be reentrant).
>> >>
>> >> --
>> >> Regards,
>> >> Konstantin
>>
>>
>> --
>> Regards,
>> Konstantin
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20201211/e0877d8d/attachment.htm>


More information about the webkit-qt mailing list