Is there an existing issue for this?
Problem
There are currently a few architectural issues that impact performance of zathura, especially regarding the startup time. To ensure no noticeable delay, the startup time from command execution to content display should be <0.1 seconds. For small and simple files, this is already fine. For more common and complex file the startup time noticeable in the range of >0.2 seconds and for large files like the 100MB arm spec document linked here the startup time is multiple seconds
I have looked a bit into the most relevant issues and identified the following three with the most significant impact:
-
to re identify files in the database, zathura creates sha256 of all files (even when no database is used). A 50MB file takes 200ms to calculate that hash, a 500MB file needs 2 seconds. This is even before any rendering happens.
We dont need a cryptographic secure hash for this use case, so switching to XXH3-128 from libxxhash would make this >20 times faster. https://github.com/Cyan4973/xxHash
-
currently, zathura parses all pages to to lay out the page grid. for a document like the ARM spec pdf with 14734 pages is takes about 2 seconds on modern high end hardware. moving to a lazy approach parsing would fix this. (Effectively meanign that zathura shows the first page immediately, and then continues to parse the following pages)
-
before showing anything zathura builds one GtkWidget per page, for the ARM document thats another 500ms. same fix as lazy parsing
Im currently looking into clean solutions that address these, the first one is pretty simple and effectively done. Any feedback and pointers would be much welcome though, especially regarding whether these changes would be supported.
Expected behavior
zathura should display the documents first page in less then 0.1 seconds regardless of file structure, pages or size
Is there an existing issue for this?
Problem
There are currently a few architectural issues that impact performance of zathura, especially regarding the startup time. To ensure no noticeable delay, the startup time from command execution to content display should be <0.1 seconds. For small and simple files, this is already fine. For more common and complex file the startup time noticeable in the range of >0.2 seconds and for large files like the 100MB arm spec document linked here the startup time is multiple seconds
I have looked a bit into the most relevant issues and identified the following three with the most significant impact:
to re identify files in the database, zathura creates sha256 of all files (even when no database is used). A 50MB file takes 200ms to calculate that hash, a 500MB file needs 2 seconds. This is even before any rendering happens.
We dont need a cryptographic secure hash for this use case, so switching to XXH3-128 from libxxhash would make this >20 times faster. https://github.com/Cyan4973/xxHash
currently, zathura parses all pages to to lay out the page grid. for a document like the ARM spec pdf with 14734 pages is takes about 2 seconds on modern high end hardware. moving to a lazy approach parsing would fix this. (Effectively meanign that zathura shows the first page immediately, and then continues to parse the following pages)
before showing anything zathura builds one GtkWidget per page, for the ARM document thats another 500ms. same fix as lazy parsing
Im currently looking into clean solutions that address these, the first one is pretty simple and effectively done. Any feedback and pointers would be much welcome though, especially regarding whether these changes would be supported.
Expected behavior
zathura should display the documents first page in less then 0.1 seconds regardless of file structure, pages or size