Optimize search performance - #11
Conversation
Build search results in /tmp, then swap them onto the card Every result row was a separate INSERT compiled and committed straight to the SD card, so a search across a large collection spent most of its time waiting on the SD card. The old database was deleted up front too, so an interrupted search left you with nothing. The list is now built in /tmp with one prepared statement inside a single transaction, copied over once, and renamed into place. The previous results stay readable until that rename. If anything fails we drop the old database so MainUI rebuilds an empty list instead of showing hits for a keyword that is no longer in active_search.
|
Here is some more info, Build search results in /tmp, then swap them onto the card Every result row was earlier a separate INSERT compiled and committed straight to the SD card, so a search across a large collection spent most of its time waiting on the card rather than searching. The old database was also deleted up front, so an interrupted search left you with nothing. The list is now built in /tmp using one prepared statement inside a single transaction, copied over once, and renamed into place. The previous results stay readable right up to the rename. Failure behaviour If the build fails at any point the old database is dropped rather than left in place. Testing
|
Improves SearchFilter search performance by reducing unnecessary work during search.
Built with the Miyoo toolchain and tested on device.