oakmac / parinfer-elisp

Parinfer in Emacs Lisp
ISC License
97 stars 3 forks source link

Increase performance by 50% #14

Closed kisaragi-hiu closed 2 years ago

kisaragi-hiu commented 2 years ago

After this package was released, parinfer-mode was made, which vendored this package as this package isn't in a package archive. That package was eventually deprecated as the author started recommending parinfer-rust-mode instead.

As a long time user of Parinfer, I found the pure elisp version to be perfectly usable, with a few low-hanging fruit optimizations to be taken (it was needlessly running parinferlib-indent-mode twice when opening files, for example), so I've been focused on optimizing and improving my own fork of parinfer-mode instead of moving onto parinfer-rust-mode.

As part of this effort I also experimented with some changes to this library, eventually landing on the two main changes here: lexical binding and using global variables instead of passing a hash table around. These add up to a 50% improvement in performance (perf.el reports indent-mode going from 0.540383s to 0.278933s on my machine with the same number of GCs).

As this repository is not archived I figured I should probably upstream these changes.

oakmac commented 2 years ago

This is really wonderful and impressive ❤️ 🤓

Thank you for the high quality contribution!