-
-
Notifications
You must be signed in to change notification settings - Fork 638
Open
Labels
performanceperformance enhancementperformance enhancement
Description
User requiring api.lua or executing setup results in most modules being required. This has a cost ~7-11ms.
See #3229 for background and timing experiments.
Only the following are absolutely required when executing setup for the first time:
008.600 000.064 000.064: require('nvim-tree.log')
008.825 000.224 000.224: require('nvim-tree.utils')
010.094 000.060 000.060: require('nvim-tree.notify')
010.097 000.147 000.087: require('nvim-tree.legacy')
012.854 000.063 000.063: require('nvim-tree.commands')
api.lua does not need to contain any requires barring notify; they can be lazily evaluated on calling the API.
This is long overdue and will greatly ease #2908
Implementation Plan
- 1 -
nvim-tree.luaMove all functions that do not relate to setup into another module. This is not API so we may refactor at will. - 2 -
api.luamove all requires inline. This is a messy and undesirable solution, however it will be resolved during Documentation: Opts luals Annotations #2934 and Multi Instance: Help #2908 - 3 - Create a new options module that contains user setup options, set during
setup. This will allow us to remove thesetupcalls for non-class modules; they can require and read from the configuration module. - 4 - Remove
M.setupcall, retrieving options from the new options module- actions/fs
- actions/node
- actions/root
- actions/tree
- buffers.lua
- diagnostics.lua
- explorer/watch.lua
- git/utils.lua
- help.lua
- keymap.lua
- lib.lua
- notify.lua
- renderer/components
- view.lua
- watcher.lua
These should be executed in separate PRs as there is a large blast radius. 1 should be broken down into small PRs to ameliorate risk and allow fast rollback.
przepompownia and gegoune
Metadata
Metadata
Assignees
Labels
performanceperformance enhancementperformance enhancement