-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sdcv: Don't walk into "res/" subdirectories #1961
base: master
Are you sure you want to change the base?
Conversation
When searching for .ifo files use the same optimization as we do in the koreader frontend in getIfosInDir(path) in readerdictionary.lua. Fortunately sdcv uses the for_each_file function exclusively to search for .ifo files, making the patch trivial. I have several dictionaries on my Kobo Aura One, some of which contain 'res' subdirectories with many files. After a restart or cold boot, the first dictionary lookup would take around 45s, while subsequent lookups would only take merely around 0.5s. My theory for this massive difference is that after reboot, the file system cache is empty, and therefore the file system structure for all the resource directories must first be loaded from the flash, which seems to be quite slow. With the patched sdcv there is now no difference between the first and the following lookups anymore. In addition, the average lookup time on my device drops from 0.5s to about 0.3s.
Wouldn't it be better to contribute this upstream? |
I have my doubts that upstream would accept it in the current form, because it does not handle the edge case that there is a dictionary named |
I looked at the code again, but I currently don't see how to implement this nicely in a generalized way, i.e. outside the controlled conditions that we have in koreader. A possible approach could the following, however I wouldn't call it nice: The directory iteration could remember when a |
What concretely is many files? |
In my |
On an SD card with FAT32 that can sometimes be surprisingly slow, even if I don't necessarily mean quite that slow. You could run a simple |
Or since I just realized you said subdirectories plural, perhaps that should be something like |
Basically the same result as observed with sdcv:
|
Right, so sdcv presumably isn't accidentally doing something inefficient, other than going through |
When searching for .ifo files use the same optimization as we do in the koreader frontend in getIfosInDir(path) in readerdictionary.lua.
Fortunately sdcv uses the for_each_file function exclusively to search for .ifo files, making the patch trivial.
I have several dictionaries on my Kobo Aura One, some of which contain 'res' subdirectories with many files. After a restart or cold boot, the first dictionary lookup would take around 45s, while subsequent lookups would only take merely around 0.5s. My theory for this massive difference is that after reboot, the file system cache is empty, and therefore the file system structure for all the resource directories must first be loaded from the flash, which seems to be quite slow.
With the patched sdcv there is now no difference between the first and the following lookups anymore. In addition, the average lookup time on my device drops from 0.5s to about 0.3s.
This change is