feat(picker): cache apropos result to speed up#3616
Open
delphinus wants to merge 1 commit intonvim-telescope:masterfrom
Open
feat(picker): cache apropos result to speed up#3616delphinus wants to merge 1 commit intonvim-telescope:masterfrom
delphinus wants to merge 1 commit intonvim-telescope:masterfrom
Conversation
6 tasks
16ea7dd to
45e6142
Compare
45e6142 to
d6f476c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This is a revised PR from #3399. This makes
:Telescope man_pagesfaster on macOS.I found
man_pagespicker is too slow on macOS. This is because theaproposcommand, that is used in this picker, is much slower on macOS than other UNIX-like systems (Linux, FreeBSD, etc.).By further investigation, this is derived from SIP (System Integrity Protection) on macOS.
aproposuses the DB:/usr/share/man/whatis, but the place is protected on macOS and cannot be written by userland commands. Soaproposalways scans the whole man directories every time.How to rebuild the whatis database? whati… - Apple Community
I resolved this by caching the result from
apropos. The cache file will be invalidated when man pages are updated. When the system creates, updates, or removes man pages, we can catch events by looking the parent directory's mtime. Directory names to look their mtime are found as below, for example.manpathcommand orMANPATHenv var.It also detects
MANSECTenv var to determine sections shown byapropos. When it detects customMANSECT, cache filename will change as below. Each cache will be invalidated individually.~/.cache/nvim/telescope-man-pagesMANSECT=1,3p,5,n:~/.cache/nvim/telescope-man-pages-1-3p-5-nType of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list relevant details about your configuration
:Telescope man_pages~/.cache/nvim/telescope-man-pagesConfiguration:
Neovim version (nvim --version):
Operating system and version:
Checklist: