-
Notifications
You must be signed in to change notification settings - Fork 42
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 of strip_trailing_whitespace()
#63
Comments
strip_trailing_whitespace()
function, as well.strip_trailing_whitespace()
Moving discussion of the performance of |
Here are some benchmark results the current method (bench_strip_trailing_whitespace below) and @kevinmatthes's iterator based approach (bench_strip_trailing_whitespace_iterator below).
The current implementation is still faster, though with a wider variance between runs. |
The current implementation is careful in not allocating any memory -- which is precisely why it's so convoluted -- where as
Allocates memory twice for every line (the calls to |
Just to say, I'm sure there's a better way of expressing the existing |
I agree that the string conversion is not optimal but I still think that an iterator approach should at least be tested since I expect the Rope queries to be performance bottlenecks while the iterator runs just once over the buffer. The question for a Rope-based iterator approach is how to emulate the string operations best without having to convert the data. An iterator approach is usually also very well readable, so researching in this direction might have benefits also for other parts of the implementation. |
More than @iainh's benchmarks?
Why? I would be very surprised if this is the case -- I wasn't exactly sure if you mean using
|
Okay, then just not applying the iterator pattern. |
#82 outlines another point: CRLF. At the moment, Zee replaces them by simple line feeds. I have absolutely no problem with that but maybe some people would like to keep their CRLF for some reasons. When working on the whitespace cropping function, it should be kept in mind to enable a simple opt-out of the CRLF removal depending on the respective settings of the configuration file. |
At the moment, I am considering possible solutions to the Colour Panic bug, see #42, and came across the
strip_trailing_whitespace()
function, as well.I found this implementation working identically compared to the current one:
Does this version raise the performance when changing the implementation in
zee-edit/src/graphemes.rs
, line 122, or is it even worse? Maybe the performance boost suffices to save the file before the exit?Originally posted by @kevinmatthes in #58 (comment)
The text was updated successfully, but these errors were encountered: