-
Notifications
You must be signed in to change notification settings - Fork 13
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
Provide comparison/benchmarks vs guess-indent.nvim
#12
Comments
Oh, I wasn't aware of
Both plugin do essentially the same thing: they auto-detect indentation quickly. The only difference is the algorithm they use:
In theory, here's the main advantage of each one:
In practice, both algorithm usually detect indentations correctly and are done in an instant so in most cases it's pretty much up to whichever name you think look fancier in your init file (Though I have to admit that I love NMAC427's idea of ignoring multi-line comments since those usually don't follow standard indentation. This should definitely be added to
In practice, both algorithms finish executing before anyone can notice so benchmarks shouldn't matter too much. However, it could be fun to see how fast they can run and how things like "using pattern matching vs raw lua code" affect performance I may try to attach some benchmarks to this issue once I get a bit more free time, I have far too much work nowadays :/ |
(I'll keep this issue open for now so that I remember to try doing benchmarks later. Also, I'll mention this issue inside the one you opened for |
Great. Thank you so much for clarifying various aspects raised here! |
I think @Darazaki summed it up perfectly - both plugins have the same goal just with a different approach. I ran some benchmarks (each time running the corresponding command 1000 times) and, except for some edge cases, In case you're interested, these are the raw numbers I got from running the
So what's the conclusion? I think the best thing is to just try out both plugins and see which one works best for your personal workflow and with the kind of files you're working with. There are cases in which |
Wow thank you very much for the benchmarks! Also I completely agree with your conclusion Closing this since every question has been answered now :) |
This is absolutely comprehensive response from both the plugin authors. Thank you so much. May I suggest pinning this issue and provide a link in the README (under a section titled alternatives/benchmarks or something equivalent) for each of the two plugins? |
Added to README! I don't think pinning this issue is necessary since there's already a link to it in the README Also, you're welcome :) |
Hi, I am interested in knowing how these benchmarks were run for my own project. Please point me to any resources if you can. Thanks |
I filled a buffer with some text and then ran the following lua script to test how much time each command took: local function profileCmd(cmd, times)
local start = tonumber(vim.fn.reltimestr(vim.fn.reltime()))
for _ = 1, times do
vim.cmd(cmd)
end
local stop = tonumber(vim.fn.reltimestr(vim.fn.reltime()))
return (stop - start) / times * 1000 -- ms
end
print("IOM: ", profileCmd(":silent IndentOMatic", 1000))
print("GI: ", profileCmd(":silent GuessIndent", 1000))
print("VS: ", profileCmd(":silent Sleuth", 1000))
print(profileCmd(":set sw=4", 1000)) |
Thank you for making this plugin. Are there advantages/USPs of using this over
guess-indent
, a newer lua plugin with a similar mandate?Perhaps you could provide an explanation and/or benchmarks comparing these two?
The text was updated successfully, but these errors were encountered: