New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Minor improvement to inccomand substitution #6949

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@KillTheMule
Contributor

KillTheMule commented Jul 3, 2017

As long as we're only previewing, we can stop looking for matches after we got enough lines for the preview buffer. Should improve performance on large files with a lot of matches.

Note: Could not check locally right now, but really wanted to create this PR to force myself to get it done, wanted to do it for a while :)

@marvim marvim added the WIP label Jul 3, 2017

@bfredl

This comment has been minimized.

Member

bfredl commented Jul 3, 2017

Nice! Can the substitution be "resumed" somehow when we get around to implement scrolling in the preview window? Or maybe should just restart it...

@KillTheMule

This comment has been minimized.

Contributor

KillTheMule commented Jul 3, 2017

Hmm, dunno, the 'trick' here is to only compute what you really need to show. If you change what you need to show by scrolling, there's basically 2 options: 1) Precompute anything anyways (just as it is now) or 2) have some kind of callback when scrolling. For 2) you could compute the proper arguments to do_sub, but doing it on every scroll line... hrmm, sounds laggy. Maybe some kind of config options for the maximum number of lines shown?

The failure of https://github.com/neovim/neovim/blob/master/test/functional/ui/inccommand_spec.lua#L983 is expected, what should I do with that test? Make a bigger file?

@justinmk

This comment has been minimized.

Member

justinmk commented Jul 3, 2017

The failure of https://github.com/neovim/neovim/blob/master/test/functional/ui/inccommand_spec.lua#L983 is expected,

Ha! Maybe by searching for something that's very far down the file? Or join the lines to make a very long line--does your perf improvement help there?

@KillTheMule

This comment has been minimized.

Contributor

KillTheMule commented Jul 4, 2017

No, won't help with long lines. I'll try that :)

(e) Hrm, for some reason the preview window does not trigger when I just have 1 line. I'm on an old version of nvim here though, I'll try at home with current master.

@KillTheMule

This comment has been minimized.

Contributor

KillTheMule commented Jul 4, 2017

Uhh that got weird. I tried slowing down the test, but now it errors out with 'invalid msg-rpc string'. Could someone have a look?

KillTheMule added some commits Jul 3, 2017

Minor improvement to inccomand substitution
As long as we're only previewing, we can stop looking for matches after we got enough lines for the preview buffer. Should improve performance on large files with a lot of matches.
@KillTheMule

This comment has been minimized.

Contributor

KillTheMule commented Jul 4, 2017

Ok, I've put up a version that works for me locally, crossing my fingers :)

(e) Lots of failures, but as far as I can see, all are unrelated (but there seems to be a host of them O_o)

@KillTheMule KillTheMule changed the title from [WIP] Minor improvement to inccomand substitution to [RFC] Minor improvement to inccomand substitution Jul 5, 2017

@marvim marvim added RFC and removed WIP labels Jul 5, 2017

@justinmk

This comment has been minimized.

Member

justinmk commented Jul 8, 2017

Merged. Nice change @KillTheMule

@justinmk justinmk closed this Jul 8, 2017

@justinmk justinmk removed the RFC label Jul 8, 2017

justinmk added a commit that referenced this pull request Jul 8, 2017

inccommand: improve performance #6949
During a preview, we can stop looking for matches after we got enough
lines for the preview buffer.

Because of this perf improvement, the 'redrawtime' test needs to be
slowed down in a different way: _long_ lines instead of just many lines.

@KillTheMule KillTheMule deleted the KillTheMule:incsub-performance branch Aug 28, 2017

justinmk added a commit to justinmk/neovim that referenced this pull request Nov 8, 2017

NVIM v0.2.1
FEATURES:
0e873a3 Lua(Jit) built-in neovim#4411
5b32bce Windows: `:terminal` neovim#7007
7b0ceb3 UI/API: externalize cmdline neovim#7173
b67f58b UI/API: externalize wildmenu neovim#7454
b23aa1c UI: 'winhighlight' neovim#6597
17531ed UI: command-line coloring (`:help input()-highlight`) neovim#6364
244a1f9 API: execute lua directly from the remote api neovim#6704
45626de API: `get_keymap()` neovim#6236
db99982 API: `nvim_get_hl_by_name()`, `nvim_get_hl_by_id()` neovim#7082
dc68538 menu_get() function neovim#6322
9db42d4 :cquit : take an error code argument neovim#7336
9cc185d job-control: serverstart(): support ipv6 neovim#6680
1b7a9bf job-control: sockopen() neovim#6594
6efe84a clipboard: fallback to tmux clipboard neovim#6894
6016ac2 clipboard: customize clipboard with `g:clipboard` neovim#6030
3a86dd5 ruby: override ruby host via `g:ruby_host_prog` neovim#6841
16cce1a debug: $NVIM_LOG_FILE neovim#6827
0cba3da `:checkhealth` built-in, validates $VIMRUNTIME neovim#7399

FIXES:
105d680 TUI: more terminals, improve scroll/resize neovim#6816
cb912a3 :terminal : handle F1-F12, other keys neovim#7241
619838f inccommand: improve performance neovim#6949
04b3c32 inccommand: Fix matches for zero-width neovim#7487
60b1e8a inccommand: multiline, other fixes neovim#7315
f1f7f3b inccommand: Ignore leading modifiers in the command neovim#6967
1551f71 inccommand: fix 'gdefault' lockup neovim#7262
6338199 API: bufhl: support creating new groups neovim#7414
541dde3 API: allow K_EVENT during operator-pending
8c732f7 terminal: adjust for 'number' neovim#7440
5bec946 UI: preserve wildmenu during jobs/events neovim#7110
c349083 UI: disable 'lazyredraw' during ui_refresh. neovim#6259
51808a2 send FocusGained/FocusLost event instead of pseudokey neovim#7221
133f8bc shada: preserve unnamed register on restart neovim#4700
1b70a1d shada: avoid assertion on corrupt shada file neovim#6958
9f534f3 mksession: Restore tab-local working directory neovim#6859
de1084f fix buf_write() crash neovim#7140
7f76986 syntax: register 'Normal' highlight group neovim#6973
6e7a8c3 RPC: close channel if stream was closed neovim#7081
85f3084 clipboard: disallow recursion; show hint only once neovim#7203
8d1ccb6 clipboard: performance, avoid weird edge-cases neovim#7193
01487d4 'titleold' neovim#7358
01e53a5 Windows: better path-handling, separator (slash) hygiene neovim#7349
0f2873c Windows: multibyte startup arguments neovim#7060

CHANGES:
9ff0cc7 :terminal : start in normal-mode neovim#6808
032b088 lower priority of 'cursorcolumn', 'colorcolumn' neovim#7364
2a3bcd1 RPC: Don't delay notifications when request is pending neovim#6544
023f67c :terminal : Do not change 'number', 'relativenumber' neovim#6796
1ef2d76 socket.c: Disable Nagle's algorithm on TCP sockets neovim#6915
6720fe2 help: `K` tries Vim help instead of manpage neovim#3104
7068370 help, man.vim: change "outline" map to `gO` neovim#7405

@justinmk justinmk referenced this pull request Nov 8, 2017

Merged

NVIM v0.2.1 #7505

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment