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

Findings from benchmarking wc-mode #19

Open
sten0 opened this issue May 10, 2023 · 0 comments
Open

Findings from benchmarking wc-mode #19

sten0 opened this issue May 10, 2023 · 0 comments

Comments

@sten0
Copy link
Contributor

sten0 commented May 10, 2023

Hi @bnbeckwith,

I've had to deactivate wc-mode again due to scaling issues, but this time I did some semiformal benchmarking, and count-words is consistently at least ~68.7% slower than calling GNU coreutils "wc". I tried a second method to remove wc's potential advantages, and this showed that count-words was 66.20% slower than wc. This is with Emacs 28.2, and with native-compilation enabled, so I'd consider it the best-case scenario.

Consequently, I think the the way forward for wc-mode, for is the following: Call "wc" for the whole region, but only asynchronously, and only as an-autosave-hook (if possible). Failing that, then as a save-hook. In either case writing to disk doesn't need to wait for the process to return.

Impact: All Linux distributions and BSDs have "wc" (MacOS has it too). I suspect WSL is slow, so Windows users would probably use of of these:
https://gnuwin32.sourceforge.net/packages/coreutils.htm
https://learn.microsoft.com/en-gb/powershell/module/microsoft.powershell.utility/measure-object?view=powershell-7.3

After that, I don't see how further optimisation will be possible without introducing some kind of "zones" which tally the words added and removed relative to the global count.

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

1 participant