Book viewer slow to open - Calibre 4.0

Bug #1846852 reported by Jacques Tremblay
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
calibre
Invalid
Undecided
Unassigned

Bug Description

Not really a bug, maybe something to be improved, but with the new Calibre 4.0, the ebook viewer is very slow to open. I timed it at 5 seconds. With the previous viewer, you doubleclicked on a book and the viewer would open pretty much instantly. The time it now takes to open is the same whether you open a book or you open the viewer directly from the calibre directory without a book : 5 seconds.
I do not use the viewer to read books, I only use it to check the quality of books and if conversions are successful and correct so I often open many books one after another so 5 seconds is a long time.

The first few times I doubleclicked on a book, I thought I had not doubleclicked quickly enough because there is no indication of any sort that the book is in the process of opening, i.e. no hourglass, so I doubleclicked again. I eventually realised there was this 5 seconds delay.

NOTE : I used AVG as my antivirus so I added the entire Calibre directory as an exception thinking it could affect the time it takes for the viewer to open but it didn't make a difference. I'm on Win 10 Pro 64 bit.

Thanks for a great app in constant development.

Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1846852

5 seconds seems excessive. On my system
time ebook-viewer small-file.epub
and then immediately closing the viewer after the book loads fully,
takes 1.8 seconds

Is the time to run the viewer actually 5 seconds even without any book?
If so, then I'm afraid there is not much I can do about it, as that is
likely simply the initialization time of Qt WebEngine.

Revision history for this message
Jacques Tremblay (8-jacques) wrote :

Yes, it takes 5 seconds just to open the viewer without any books.
When the "open a new book" page finally loads, I can then select any book in the list of recently viewed books or open a book from your computer and it opens immediately. I can then by right clicking in the book go back to the "open a new book" page and select any other books and everything is instantaneous. The delay is only when opening the viewer.
If the viewer is opened and I open another instance of it, the new instance also takes 5 seconds to open.
Is the Qt WebEngine a new thing ? Because I didn't have the same problem with the previous version of the viewer...
I still suspected the AVG antivirus to create the problem so I completely uninstalled it from my system but it did not help. Anyway I've now switched to Windows defender antivirus instead.
Do you think that an intitialization time of Qt WebEngine of 5 seconds on a system with an Intel 8700K cpu and 16 GB of RAM is normal ?
Is there any way to set Calibre so that when doubleclicking on a book in the library, it would load the book in the already opened viewer instead of opening a new instance of the viewer? Since there's no delay when opening a book from the open new book page, that should solve the problem when opening many books one after another. It's practical to have separate instance of the viewer opening for each book but I would forego this as a workaround to avoid the 5 seconds delay for each book.
Thanks for your time.

Revision history for this message
Kovid Goyal (kovid) wrote :

Yes, webengine is a new thing, see
https://calibre-ebook.com/new-in/thirteen

There is already viewer functionality to have a single instance,
so then every time you trigger the viewer the book will open in the
existing viewer. I just haven't got around to exposing that option in
the viewer preferences, as yet.

 As for the actual startup delay, it definitely does not sound normal, I will
 investigate after the craziness from 4.0 dies down.

Revision history for this message
Jacques Tremblay (8-jacques) wrote :

Thanks for the quick reply.

I'm looking forward to the option to have a single instance of the viewer.

I saw in New in calibre 4.0 that the viewer now shares a codebase with the in-browser viewer. I don't know if it's relevant or even if Chrome uses webengine but Chrome on my system has been a bit slow to start for a while - not 5 seconds but 3.5 to 4 seconds - when I open it the first time. Once it is opened, opening new tabs or instances is immediate. I've search all over the internet but I never found a solution for this small delay. Maybe something on my system is scanning this webengine before it initializes.

Anyway, I still love calibre and I can live with the 5 seconds delay but I really appreciate that you will keep this in mind and investigate when the craziness as you say dies down. Thank you again.

Regards.

Revision history for this message
Kovid Goyal (kovid) wrote :

Yes Qt webengine is basically the browser core from Chrome.

Revision history for this message
Kovid Goyal (kovid) wrote :

There is one possible source of slowness that comes from calibre, if you
run calibre from source, i.e. with CALIBRE_DEVELOP_FROM set each time
the viewer runs it has to compile its code, which can take a few
seconds.

Revision history for this message
Jacques Tremblay (8-jacques) wrote :

I don't know what you mean by running calibre from source.
The program is installed in C:\Program Files\Calibre2.
The shortcut target is : "C:\Program Files\Calibre2\calibre.exe"
When I update calibre, I simply run the msi file found on your website.

Note : I've been running Calibre for many years and at some point quite a long time ago, I switched from the 32 bit to the 64 bits version.

Revision history for this message
Kovid Goyal (kovid) wrote :

If you dont know what it is, then you are not doing it :)

Revision history for this message
Jacques Tremblay (8-jacques) wrote :

Good :)

Although I wish I was doing it because it could have explained the delay...

Revision history for this message
Eli Schwartz (eschwartz) wrote : Re: [Bug 1846852] Re: Book viewer slow to open - Calibre 4.0

Incidentally, on the topic of an option for a singleinstance of the
ebook-viewer, this was just implemented via
https://github.com/kovidgoyal/calibre/commit/a87c59e8c8199b53ae3994031ed65ed9579a4ff0

So this means you will have that option in the next version of calibre
(calibre is released most Fridays).

I've tested the new feature and it works great. :)

(I can test it because I don't rely on the executables Kovid provides,
but build my own from the source code. More generally anyone can test
out new features before they are officially released, this is the
CALIBRE_DEVELOP_FROM thing that Kovid mentioned which you aren't using.
While in theory you could do the same by following the instructions at
https://manual.calibre-ebook.com/develop.html it seems like a lot of
bother for someone who doesn't already know what they are doing. It's
ultimately a developer-centric option, not a user-centric one.)

Revision history for this message
Jacques Tremblay (8-jacques) wrote :

Thanks for these details....

It would be indeed a lot of bother for me to learn how to build my own build from the source code.

I'm happy to wait for the next version of Calibre.

I can't wait for the new option in the ebook viewer. I had to open quite a few books today after converting them and the delay as the viewer was opening new instances each time was really slowing down my workflow.

Revision history for this message
Eli Schwartz (eschwartz) wrote :

An eminently reasonable perspective. :)

Given the number of changes including a bunch of useful bug fixes for
the brand new viewer (brand new things will always have their teething
troubles, regardless of how long they are beta tested), I'm quite
positive Kovid will have a release this very Friday, so expect to wait
one week, not two.

Revision history for this message
Vladimir (vlpaunov) wrote :

calibre 4.0

Book viewer does not start properly at all. Does not open a book. It crashes every time.
Blocks my AMD Radion HD Adapter for a moment and the adaper recovers itself after that.
And no book open.
But still calibre 4.0 does not work properly even if I click on drop down menu of a button it
does the same....Blocks my AMD Radion HD Adapter for a moment and then button menu does not function.
I use calibre 4.0 64bit. I use Windows 7 64bit. I had no problem with Calibre up to now.
I had to downgrade to previous version. NO problems there.

Revision history for this message
Jacques Tremblay (8-jacques) wrote :

V4.1

Thank you so much. The viewer still take 5 seconds to initialize but once it is done, with the new option, I can leave it open and open new books in the same instance without any delay. This is excellent.

Also, I have a mouse with free motion scrolling which means I can scroll really quickly through a book. With version 4.0 the viewer would sometime freeze when I scrolled too quickly. With 4.1, the viewer no longer freezes when I scroll quickly. I tried on purpose to scroll extremely quickly to make it freeze and I didn't succeed so far. This is also an excellent improvement.

Thanks again.

Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1846852

I'm glad the option helped. I would like to nail down the cause of the
slow start on your system, but I dont really have any ideas other than
Qt. Some google searching revealed various issues with Qt WebEngine
slowdowns on windows machines with VirtualBox and/or unusual networking
setups, but those issues were resolved a while ago. Still might be
something to check on your machine.

Revision history for this message
Jacques Tremblay (8-jacques) wrote :

I don't have any unusual networking setup as far as I know and not using virtualisation.

It is frustrating indeed not to be able to work out what is causing this delay.

I've been looking at many things and searched on the web but to no avail.

I have a question : I was checking the task manager when opening the e-book viewer and I found that when the viewer opens, it creates two instances of the QtWebEngineProcess. One of the process uses 7.4 MB of memory and the other 24.9 MB (that is when the viewer is opened without a book loaded). Is this doubling up of the process normal behaviour ?

Revision history for this message
Kovid Goyal (kovid) wrote :

yes, it is normal, one is for the viewer chrome and one is for the
iframe in which the actual book text is rendered.

Revision history for this message
Jacques Tremblay (8-jacques) wrote :

I don't know if this info might help with finding a solution for the delay I experience when opening the ebook viewer but I thought I would let you know anyway.

I had a similar 5 second delay when opening Chrome and Firefox but not Edge.

I just updated Chrome to the new version 78 and the delay has now disappeared.

Chrome now opens instantly just like Edge.

Only Firefox is left with a 5 second delay when starting, just like the ebook viewer.

Hopefully this might suggest something to you. Regards.

Revision history for this message
Jacques Tremblay (8-jacques) wrote :

Further info : the delay when opening Chrome has reappeared - I don't know when, I just noticed today.

I ran Malwarebyte because I suspected I might have some malware. It found a few things PUP, adware and the likes, which it removed easily, but after reboot, the delay is still there and Malwarebyte no longer finds anything.

I also reset my network adapter but it didn't help either.

I'll keep looking for a solution.

Only Edge doesn't have a delay when opening. Does Edge use WebEngine ?

Revision history for this message
Kovid Goyal (kovid) wrote :

Originally edge did not but newer versions of it are just a skin on top
of chrome. Dont recall if the new versions have been released to the
public yet or not.

Revision history for this message
Jacques Tremblay (8-jacques) wrote :

For you info Kovid !

I found what was the problem. It was the nahimic service that comes with Sonic Studio, a piece of audio software that comes with the Asus ROG Maximum X Code motherboard. I disabled the service and now the ebook viewer, chrome and firefox all start without any delay. Disabling the service means that Sonic Studio now longer works but since I never used it anyway, that's not a problem.

Here's a link to the Windows Ten Forum thread where I found the solution :
https://www.tenforums.com/browsers-email/123631-browsers-delayed-launch.html

I thought you'd like to know in case someone else inquire about the same problem in the future.

Strange that an audio service affects your ebook viewer. I guess since it uses the same webengine that web browsers use, and audio is often involved in web pages, that must be why the audio service had an effect.

After solving the problem, I found other forums on the web where people complained that the nahimic service was causing them all sort of problems. So in the end, I'm glad you updated Calibre and the ebook viewer, because it forced me to find the answer. Before that, I'd learned to live with the delay when opening Chrome or Firefox.

Thanks again for always responding so quickly to my earlier queries. Regards.

Revision history for this message
Kovid Goyal (kovid) wrote :

Cool, glad you figured it out.

 status invalid

Changed in calibre:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.