rail5 / polonius

A text editor for very large files
GNU General Public License v3.0
5 stars 1 forks source link

polonius-editor: "Instruction Optimization" #24

Open rail5 opened 1 year ago

rail5 commented 1 year ago

REPLACE instructions are always preferred to INSERTs and REMOVEs, seeing as they're much faster

If a user types, for example:

-a "REMOVE 0 0"
-a "INSERT 0 a"

Polonius should be able to detect that this could be optimized into a single REPLACE instruction:

-a "REPLACE 0 a"

This would be major, especially for very large files

rail5 commented 1 month ago

This is being developed now: https://github.com/rail5/polonius/wiki/Instruction-Optimization

But a little thought will be required to figure a decent (efficient) algorithm to apply the theorems

Polonius should also offer a --no-optimize option, telling it to skip this process when wanted.

Ideally, the UIs would optimize instructions as they're building them, so that by the time the user presses ctrl+s and the instruction sequence is sent to polonius-editor, it's already down to a minimum, having been optimized without the user having noticed