Originally Posted by DanielCoffey
I have created private issue 82 for you with the slow epub attached. I hope it behaves the same on your PC as it does on mine.
It does. It most certainly does.
It just that Sigil is not the problem. The epub file is. The markup is... horrible, to say the least. For instance, every paragraph with text starts like this:
two paragraphs with text there is code like this:
<p><a id="p1033" name="p1033"/></p>
Which does God knows what.
And I see what you mean when you said the text was centered. I thought you meant fully justified, but no, it is really centered
. Removing the CSS style that applies "text-align: center" fixed this.
With that CSS style gone, and after removing all the useless "p/anchors" and the onmouseover handlers with some regexes in notepad++, your file now takes up 30MB less memory and can be nicely edited in Sigil with no lag. So CPU usage solved.
The memory consumption is still around 100MB, but your file is 80k XHTML lines-of-code. It is 1.4MB as an epub because epubs are compressed ZIP archives, and plain text gets compressed nicely. In Sigil, text is in uncompressed UTF-16 which means at least two bytes for every character, whereas your file is English in UTF-8, so only one byte per character stored. This effectively doubles the memory required to store your text in Sigil.
Now take into account that because of technical limitations of Qt widgets used for Code View and Book View, there are three
text buffers instead of one, and that Book View is an embedded web browser... these things add up.
In the end it was your file that was causing the lag. Must have been an old version of calibre they were using when they created it, because that's some really painful markup.