Comments (4)
It seems that it's not just the macro that is slowed down. Even trying to manually add/remove a new list item is just as slow when I have 5 lists (most contain only a few items; one contains around 150 items). I have included another profile which shows some functions are called 700,000 times.
from vimwiki.
Ok, so see also: #1360 - "Slowdown when pressing Enter/o".
In both cases, it looks like folding is the culprit. (Edit: Or maybe not, on #1360, after a closer read.)
For this one, I was able to reproduce the slowness with ~1500 list items and g:vimwiki_folding = 'expr'
. It disappears with folding disabled. I note from your profile that you probably have folding set to list
, but it seems like it would be worth improving performance for both VimwikiFoldLevel()
and VimwikiFoldListLevel()
.
A few more details below.
On my config with g:vimwiki_folding = 'expr'
:
FUNCTIONS SORTED ON SELF TIME
count total (s) self (s) function
58623 1.472765 0.685200 vimwiki#vars#get_syntaxlocal()
19540 2.000083 0.526967 VimwikiFoldLevel()
58629 0.787832 0.408126 vimwiki#vars#get_wikilocal()
58629 0.379706 vimwiki#vars#get_bufferlocal()
1 2.060117 0.032026 vimwiki#lst#kbd_o()
2 0.817758 0.021674 <SNR>188_substitute_rx_in_line()
560 0.010297 <SNR>134_get_syn()
140 0.018531 0.007563 airline#highlighter#get_highlight()
84 0.023616 0.006906 airline#highlighter#exec()
20 0.005594 ale#path#FindNearestFile()
2 0.036368 0.004926 airline#highlighter#highlight()
30 0.002814 <SNR>134_GetHiCmd()
20 0.002445 0.001629 ale#engine#IsExecutable()
84 0.001492 <SNR>134_CheckDefined()
6 0.001287 vimwiki#u#is_codeblock()
18 0.003410 0.001102 <SNR>174_RunIfExecutable()
1 2.063465 0.000976 vimwiki#u#count_exe()
28 0.014998 0.000925 <SNR>134_exec_separator()
2 0.015341 0.000892 <SNR>174_GetLintFileValues()
10 0.006132 0.000827 ale#path#FindNearestExecutable()
On my config with g:vimwiki_folding = ''
:
FUNCTIONS SORTED ON SELF TIME
count total (s) self (s) function
560 0.010501 <SNR>134_get_syn()
20 0.008574 ale#path#FindNearestFile()
140 0.019130 0.007929 airline#highlighter#get_highlight()
84 0.024842 0.007257 airline#highlighter#exec()
2 0.038138 0.005473 airline#highlighter#highlight()
30 0.003014 <SNR>134_GetHiCmd()
20 0.003647 0.002438 ale#engine#IsExecutable()
18 0.005184 0.001747 <SNR>174_RunIfExecutable()
84 0.001592 <SNR>134_CheckDefined()
2 0.023510 0.001387 <SNR>174_GetLintFileValues()
10 0.009369 0.001249 ale#path#FindNearestExecutable()
20 0.001209 ale#history#Add()
2 0.021753 0.001105 <SNR>174_RunLinters()
2 0.001663 0.001071 ale#linter#Get()
28 0.015201 0.000978 <SNR>134_exec_separator()
35 0.000943 ale#Var()
20 0.019806 0.000843 <SNR>174_RunLinter()
5 0.040045 0.000769 airline#check_mode()
5 0.000972 0.000735 ale#ShouldDoNothing()
10 0.001434 0.000707 airline#extensions#ale#get()
The current implementation of VimwikiFoldLevel()
winds up making a lot of get_syntaxlocal()
calls here, so maybe that could be optimized somehow or another. I'm also not quite sure why it gets called so many times, but my grasp of how foldmethods work isn't great to begin with.
" Get fold level for 1. line number
function! VimwikiFoldLevel(lnum) abort
let line = getline(a:lnum)
" Header/section folding...
if line =~# vimwiki#vars#get_syntaxlocal('rxHeader') && !vimwiki#u#is_codeblock(a:lnum)
return '>'.vimwiki#u#count_first_sym(line)
endif
" Code block folding...
" -- previously it would always increment when it saw a ```, so we never left the code block. (See #1323)
let prevline = getline(v:lnum - 1)
let nextline = getline(v:lnum + 1)
" -- Start: assumes empty line before
if line =~# vimwiki#vars#get_syntaxlocal('rxPreStart') && prevline =~# '^\s*$'
return 'a1'
" -- End: assumes empty line after
elseif line =~# vimwiki#vars#get_syntaxlocal('rxPreEnd') && nextline =~# '^\s*$'
return 's1'
endif
return '='
endfunction
from vimwiki.
@brennen thank you for the investigation and the hard paste of the code so that I could read from my email, and it caught my interest :-) I think the fix will be in those lines
@apsinthium thank you so much also for the short and explicit report. Can you please add:
- The example Wiki file (maybe change each word by "Lorem" for privacy)
- The example macro
This will help a little for the dev and a LOT for the non-regression test.
Thank you.
from vimwiki.
@tinmarino
Test wiki: Lorem.zip
Test macro: let @v="\<C-c>\<Down>i\<Right>\<Right>\<Right>\<Right>\<Right>\<Right>\<Del>L\<C-c>\<C-0>"
Obviously this macro is not optimized/purposeful in this scenario, but it will give you an idea of the issue.
from vimwiki.
Related Issues (20)
- Improve docs for opening links in existing split: How to give [reuse] Argument to VimwikiSplitLink? HOT 2
- Is it possible to make enter on GitHub links go to repo in filesystem? HOT 1
- (neovim) Vimwiki always creates .wiki files instead of .md HOT 2
- How can I disable VimWiki's table mode? HOT 1
- vimwiki_tags not generated for markdown syntax files
- VimWiki "Wiki" section in Github allows everyone to create pages HOT 2
- Addition of new line is not reflected in conversion from .wiki to .html HOT 1
- Help setting different dirs from diary and zk
- Link works for VIM 9.0 but report error for VIM 9.1
- Links that line wrap are badly formatted HOT 3
- VimwikiSearchTags does not work with empty `pre_mark`
- Missing </blockquote> tag in html
- after update from 2.5 to 2024.01.24, vimwiki doesn't work HOT 3
- Data lost when the wiki name is truncated.
- Avoid listing deprecated functions in command autocomplete
- backport ZettelBacklinks as VimwikiGenerateBacklinks HOT 1
- [[file:]] with space is not working
- Can not use <CR> to confirm coc's completion in vimwiki HOT 1
- Cannot toogle checkbox with <C-Space>
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vimwiki.