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

Delete (and Insert?) code is O(n^2) #9

Open
driusan opened this issue May 22, 2016 · 0 comments
Open

Delete (and Insert?) code is O(n^2) #9

driusan opened this issue May 22, 2016 · 0 comments

Comments

@driusan
Copy link
Owner

driusan commented May 22, 2016

There's various places in the editing code that do things like
newBuffer := make([]byte, size)
copy(newBuffer, oldBuffer)
copy(newBuffer[start:], stuff)
copy(newBuffer[end:], oldBuffer[offset:])

to insert or delete from the middle of a buffer. It's been pointed out that this is quadratic.

This isn't an issue or even noticeable for average-sized source code files, but is going to be an issue for editing very text files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant