Discussion:
[zathura] Zathura is slow when searching the first time
Ignas Anikevičius
2013-11-01 22:33:02 UTC
Permalink
Dear list,

I was wondering if anybody could explain me why zathura is quite slow during
the first search? Try the following file as an example:

http://www.komascript.de/files/scrguien.pdf

What I observe:

- During the first search zathura becomes unresponsive and when it has
"finished searching, then it becomes responsive again and everything is
fine.

- Memory usage goes up from about 180MB to about 320MB during the first
search, but subsequent searches do not cause an increase in memory.

- Subsequent searches are also much much faster, almost instant.

The above things make me wonder if we create another copy of all zathura pages
and then use them for searching or what? Where does the memory go? I'd really
love to use zathura full time, but sometimes search functionality is just too
resource intensive.

Thanks,

Ignas A.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: digital-signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.pwmt.org/archive/zathura/attachments/20131101/0671d531/attachment.sig>
Sebastian Ramacher
2013-11-02 03:05:51 UTC
Permalink
Hi Ignas
Post by Ignas Anikevičius
I was wondering if anybody could explain me why zathura is quite slow during
http://www.komascript.de/files/scrguien.pdf
- During the first search zathura becomes unresponsive and when it has
"finished searching, then it becomes responsive again and everything is
fine.
Searching is currently done in the main thread, which causes the UI to
freeze if the search needs some time to finish.
Post by Ignas Anikevičius
- Memory usage goes up from about 180MB to about 320MB during the first
search, but subsequent searches do not cause an increase in memory.
That's probably caused by the backend libraries loading the file into memory.
Post by Ignas Anikevičius
- Subsequent searches are also much much faster, almost instant.
I guess that's because most of the interesting stuff is now cached.
Post by Ignas Anikevičius
The above things make me wonder if we create another copy of all zathura pages
and then use them for searching or what? Where does the memory go? I'd really
love to use zathura full time, but sometimes search functionality is just too
resource intensive.
We don't copy any pages. The only thing we do while searching is calling
the respective seach function from the plugin which forwards to the
search function provided by the backend.

(Note that the mupdf plugins keeps the extracted text in memory. This
could explain the groth in memory usage you see. But without knowing
which plugins you are using, I'll state what zathura itself does.)


There is one thing we need to do with the search code and that is to run
in its on thread.

There is a bug for the search performance issue at
http://bugs.pwmt.org/issue330.

Regards
--
Sebastian Ramacher
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.pwmt.org/archive/zathura/attachments/20131102/0f09ad5f/attachment.sig>
Ignas Anikevičius
2013-11-02 15:29:17 UTC
Permalink
Hi Sebastian,

On 02/11/13 04:05:51 +0100, Sebastian Ramacher wrote:
<...>
Post by Sebastian Ramacher
We don't copy any pages. The only thing we do while searching is calling
the respective seach function from the plugin which forwards to the
search function provided by the backend.
(Note that the mupdf plugins keeps the extracted text in memory. This
could explain the groth in memory usage you see. But without knowing
which plugins you are using, I'll state what zathura itself does.)
I was using the poppler plugin and I do not know if it does something similar.
Post by Sebastian Ramacher
There is one thing we need to do with the search code and that is to run
in its on thread.
There is a bug for the search performance issue at
http://bugs.pwmt.org/issue330.
I will look into this and see if I can help in any way. Thanks for explaining
everything. Once we have another thread for searching, we could in theory then
thing about caching mechanism to make the first search slightly faster. But
first - the threading issue.

Cheers

Ignas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: digital-signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.pwmt.org/archive/zathura/attachments/20131102/bbc9b5b8/attachment.sig>
Sebastian Ramacher
2013-12-24 13:22:53 UTC
Permalink
Post by Ignas Anikevičius
- Memory usage goes up from about 180MB to about 320MB during the first
search, but subsequent searches do not cause an increase in memory.
In fact there was a memory leak in poppler's implenentation of the search
function. At least that bit should be better now.

Regards
--
Sebastian Ramacher
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.pwmt.org/archive/zathura/attachments/20131224/055b8884/attachment.sig>
Loading...