aboutsummaryrefslogtreecommitdiff
path: root/data/plugins/language_cpp.lua
diff options
context:
space:
mode:
authorJefferson González <jgmdev@gmail.com>2024-06-25 05:52:57 -0400
committerGitHub <noreply@github.com>2024-06-25 05:52:57 -0400
commitb774ddfe3680635046097d1e0a4553b0019ea26f (patch)
treeb7436bace9ce6af7e40334211860f9bbc0b589c1 /data/plugins/language_cpp.lua
parent9db6360c2d36d550591eeacbe9f39a20293a81ca (diff)
downloadpragtical-b774ddfe3680635046097d1e0a4553b0019ea26f.tar.gz
pragtical-b774ddfe3680635046097d1e0a4553b0019ea26f.zip
Basic doc/docview cache for better performance (#105)
Currently, DocView:get_col_x_offset() is an expensive operation when used on long lines. Plugins that use it extensively like: drawwhitespace, colorpreview or selectionhighlight, cause the editor to hang or not respond when dealing with huge lines. Some example of files that cause the editor to hang are minified css or javascript files. While no one would casually edit these files it is totally normal to open them while inspecting a codebase. For this reason a basic cache system is introduced caching the values returned by such functions when necessary. Another slow function can be DocView:get_x_offset_col(), so this change leverages the caching performed on col_x_offset to perform faster x_offset_col and keep it simple. Beside adding the data cache, this work also introduces the ability of getting each token starting from a specific column on the line. This feature reduces the amount of iterations needed to calculate a column position since we can resume from a specific column. * Stop tokenizer if doc referenced from closed view This stops the tokenizer when a doc belongs to a docview that got closed. Tokenization of really long lines could make the editor a bit unresponsive and this change gives the user the power of ending the tokenization inmmedietly when the associated docviews are closed. * Take into consideration utf-8
Diffstat (limited to 'data/plugins/language_cpp.lua')
0 files changed, 0 insertions, 0 deletions