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

Use of Tree line tracker in incremental mode #448

Merged
merged 2 commits into from
Jun 18, 2019
Merged

Conversation

angelozerr
Copy link
Contributor

Fix #426

Signed-off-by: azerr [email protected]

@angelozerr
Copy link
Contributor Author

angelozerr commented Jun 18, 2019

When text changed, the TextDocument must update:

  • the text content
  • the line tracker which contains lines informations (length, offset of the line).

Before this PR, incremental mode used ListLineTracker which was recreated each time that text changed (compute of the all lines). This PR uses now TreeLineTracker to update line informations where text changed (kind of incremental mode for line informations computing).

To see the performance in action with tree line tracker, you can execute the TextDocumentUpdatePerformance . This test inserts a space in the nasa.xml in a loop.

  • with tree line tracker it takes around 40 - 50 ms (with this PR)
  • without tree line tracker (with listlinetracker which is created each time) it takes around 140 - 300 ms (you can start TextDocumentUpdatePerformance in the master by copying/pasting this class in the master).

The explanation of this improve of performance is that the update of line informations is done with a replace method in tree line tracker and although with list line tracker, it recomputes the whole lines each time.

Copy link
Contributor

@NikolasKomonen NikolasKomonen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great for me. I really noticed the difference on a 100,000 line file.

Before auto closing tags wouldn't work, but its really fast now.

@angelozerr
Copy link
Contributor Author

Before auto closing tags wouldn't work, but its really fast now.

Thanks @NikolasKomonen for your feedback!

@fbricon anything else? It should be very cool if this PR could be merged this night.

@fbricon
Copy link
Contributor

fbricon commented Jun 18, 2019

I've pushed a small change to adjust the logging level with -Dlog.level in the server VM args, to minimize polluting the logs.
Now I'm ok to merge

@angelozerr angelozerr merged commit a0254be into master Jun 18, 2019
@angelozerr
Copy link
Contributor Author

Thanks guys for your review

@angelozerr angelozerr deleted the treelinetracker branch June 18, 2019 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improved TextDocument update (in async) performance with TreeLineTracker
3 participants