Closed iphydf closed 2 years ago
I tried to follow the style of surrounding code. Let me know if there's anything style-wise to fix.
Regarding start
and end
: if you're worried about performance of those being inside the function, don't be, they are lifted by the compiler. If style-wise it's not OK, I'm happy to lift them manually, though.
Thank you for your work on this!
This change is now released in 5.35.
Speedup is about an order of magnitude and change (as expected: 23 times faster for 300KB: 93s -> 4s).
The current algorithm has polynomial time complexity. The new algorithm runs in linear time and is generally much more efficient because it operates on packed byte strings instead of linked lists of Char.
Addresses part of https://github.com/jtdaugherty/vty/issues/231, but there is more to do.
Some timing:
As we can see, it's still
O(n^2)
overall, probably because of the calls tobracketedPasteFinished
. I'll investigate that next. The constant factor overall is much lower now: