Skip to content
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

Performance improvement #8

Open
greenfork opened this issue Apr 27, 2020 · 2 comments
Open

Performance improvement #8

greenfork opened this issue Apr 27, 2020 · 2 comments

Comments

@greenfork
Copy link
Contributor

kakboard/kakboard.kak

Lines 153 to 158 in 4cc87b2

while test $# -gt 0; do
escaped=$(echo "$1" | sed -e 's/</<lt>/')
echo map global normal "$1" \
"': kakboard-with-pull-clipboard $escaped<ret>'"
shift
done

This and the next loop add about 50ms total to startup time. If we define these commands manually using map: str-list kakboard_paste_keys p P R <a-p> <a-P> <a-R> then it goes down to under 5ms.

I'm not asking for anything in particular, but this might be useful to someone.

My config for reference:

set global kakboard_copy_cmd 'xclip -in -selection clipboard'
set global kakboard_paste_cmd 'xclip -out -selection clipboard'

map global normal y ': kakboard-with-push-clipboard y<ret>'
map global normal c ': kakboard-with-push-clipboard c<ret>'
map global normal d ': kakboard-with-push-clipboard d<ret>'

map global normal p ': kakboard-with-pull-clipboard p<ret>'
map global normal P ': kakboard-with-pull-clipboard P<ret>'
map global normal R ': kakboard-with-pull-clipboard R<ret>'
@lePerdu
Copy link
Owner

lePerdu commented Apr 27, 2020

Yeah I cringe a little every time I remember that Kakoune constantly runs a ton of shell commands at startup and on every keypress. I don't really want to remove kakboard-enable/disable since it would require extra user configuration (the code shown above), but this is definitely a good option if you want to improve performance at the cost of some more explicit and repetitive configuration.

P.S. @greenfork Is there an easy and fancy way to measure Kakoune's performance, or are you just using a debugger / shell commands?

@greenfork
Copy link
Contributor Author

Nothing fancy really, I run time measurement of kakoune startup in a loop and edit config, as a result it shows changes in real time. I use elvish as a shell and for me the command is

while true { -time { kak -e quit }; sleep 1 }

and then I just edit config, save and see if it changes.

About all the extra shell commands on init and keypress: I managed to reduce init time to under 100ms so it's generally fine. Mostly by removing plug for loading modules, I use it just to download and upgrade plugins. And keypresses - I don't notice anything significant there too, but I may be running a comparatively lightweight config in this regard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants