Skip to content

Help browser: add an index cache to speed up launch times.

Albert Gräf requested to merge aggraef/purr-data:search-index-cache into master

This is another one of my pet peeves, so it would be nice if it could still make it into 2.14.1. Added a cache to the index to considerably speed up launching the help browser. Tested on Linux and Windows so far, there I get speedups in the 3-4x ballpark, depending on the OS and the number of indexed help patches (the more the better).

Features:

  • Rebuilds and caches the search index if there is no cache yet, or if the cache is outdated (i.e., any cached directory or its parent was removed or modified since the cache was last created).

  • Keeps track of the modification times of all cached directories of help files, as well as their parent directories, in order to determine when the cache is outdated. The parents are tracked to catch changes where new sibling directories are added. This may produce some false positives and still isn't 100% foolproof, but it is as close as we can get if we still want to achieve substantial speedups.

  • Automatically rebuilds the index (and cache) from scratch, as soon as the help browser is relaunched after changes to the browser configuration in the gui prefs. So there's no need any more to relaunch Purr Data to have these changes take effect.

Both the index cache and the directory timestamps are maintained as ordinary text files with a straightforward syntax (basically colon-delimited csv) in the user's home directory. The files are located in configuration directories (.purr-data on Linux and Mac, AppData/Roaming/Purr-Data on Windows). Thus it's easily possible to modify these files with external tools (e.g., if we want to upgrade the file format in the future.)

Merge request reports