question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IncrementalTextDocument.getText performance issue

See original GitHub issue

IncrementalTextDocument.getText is much slower than FullTextDocument.getText

Unfortunately, there’s existing code that calls TextDocument.getText in loops. TextDocument.getText is the only API to get the content of a TextDocument and it was never specified that this is a potentially expensive operation.

The fix is probably to have IncrementalTextDocument.getText remember the string instead of recomputing it every time.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
dbaeumercommented, Oct 22, 2019

@aeschli and I had a long disucssion about this. Our finding are:

  • there is not a single best incremental text document implementation
  • the implementation mostly depends on the scanner that is used afterwards. If the scanner for example uses a streaming API the text document best exposes something like a character sequence.

So we decided to move forward as follows:

  • refactor the server code to make a TextDocuments generic so that users can bring their own text document implementation.
  • remove the dependency to microsoft/vscode-textbuffer

Let server implementors decide which incremental text buffer implementation they want to use. One will be piece tree implementation.

Since we never had the incremental text document in a NON next version this will not be a breaking change.

2reactions
rebornixcommented, Oct 22, 2019

It sounds right to me. The way of reading text buffer can be only optimized based on what the scanner asks for and the detailed implementation of the buffer.

vscode-textbuffer can be used as an example how another text buffer implementation can be hooked into lsp-node in samples or readme.

Read more comments on GitHub >

github_iconTop Results From Across the Web

performance overhead of the gettext internationalization ...
What is the performance overhead during startup of a program that uses gettext (load shared library? How are the translations loaded into ...
Read more >
Using the gettext filter – legit or not? - WordPress.org
A simple text change will not cause that significant of a performance issue, but if there is any logic involved in the gettext...
Read more >
The dangers of the gettext filter - Pippin's Plugins
The filter provides a way to easily change international-ready text via a simple filter call, but it can also have a serious impact...
Read more >
Language Server Extension Guide - Visual Studio Code
Learn how to create Language Servers to provide rich language features in Visual Studio Code.
Read more >
GNU gettext utilities
Please include the manual's edition number and update date in your messages. ... a poor performance if some string has to be translated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found