2 ideas to Accelarate ubooquity?

Elouan 7 years ago updated 7 years ago 1

I run ubooquity on a synology DS212, it's a low memory device but sufficient for the job.

There are 2 points that make ubooquity very slow:

- opds acces. I use chunky reader and It takes a long time to get the initial list of folders. After that when I click on a directiry, it's fast, but the initial folder list of quite long (several minutes). I suspect this is because ubooquity is computing dynamically the list to provide and it takes a long time on my collection. Maybe you could pre-compute that initial list after the scanning process, this way it would make it faster

- latest comics. (opds or web acces) Same situation: it takes a long time to get the list, and I suspect it's the same reason. Mybe you could pre-compute that list after the scan to make it faster?

Here is an other point that would benefit from optimization, it would be a big benefit for users like me that use a small hardware to run ubooquity and like reading on-line.

when using the web interface to read comics, it take a looong time to load the first 2 or 3 pages; I can understand why loading the first page is slow (ubooquity has to load the reader, unpack the comic, load the image renderer, etc...) but I don't understand why loading pages 2 and 3 is significantly slower that loading the pages that follow. After the first pages, there are some slowness every now and then, which I can understand (I'm guessing some background process is interfering with the reader), but it's not systematic and it's not as slow either (or maybe it is related after all because it's about updating the cache?). But the first pages are really very slow to load

I'm guessing this is because of memory limitations on my system (I allow only 128Mo for ubooquity to run on my NAS) because the problem is a lot worse on large files than on small files. On very large comics (comics whose size exceed 80Mo) loading the first pages is so slow that I've given up reading them online entirely.

I'm not sure what is causing the problem exactly: loading a few images in memory for caching should not take more than 10Mo of memory; Even on the best scans, comic page rarely exceed 2Mo. This is something my system should allow: ubooquity uses about 30Mo of memory when browsing the database, and it goes up to 70Mo after I've opened a comic, this should leave 30Mo of memory for caching images, meaning more than 10 pages even for the largest files...

My feeling is that memory management could be improved:

- unpacking the comics uses memory and that memory is not freed at the end of the unpacking: memory usage goes up when opening the comic and doesn't go down after that...

- reading comics loads new images into the cache but old images are not unloaded from memory (when I track memory usage, I only see memory usage growing: it should fluctuate around an average value shouldn't it?)

- when closing a book, the memory is not cleared. Opening a second book right after closing the first one is just not working: I have to wait a long time for memory to go down to the initial 30Mo (I'm guessing it's how long garbage collector does its job)