Repository navigation
Conversation
Use an internal list of positions that permit faster access, avoid unnecessary copies and reduce memory consumption compared to IDocument Position handling.
|
This affects any kind of positions. Some of preliminary digging I did for mihnita/ansi-econsole#66: But the operation is something like this: Note: these are not real names. I did the research, but didn't write them down. The start / end positions are stored in Possible solution: There are probably kinds of documents that always
Probably any doc attached to a console behaves like that. The hyperlinks and ansi escapes are examples of non-overlapping positions. For the solution it would be nice if we detect that and make the list of endings also sorted. And then, of the document deletion happens from the beginning, find the range of positions to delete, and call |
|
I would like to add some information: ending positions in AbstractDocument are sorted by end offset whereas starting positions are sorted by start offset. It is used by
|
| return new IHyperlink[0]; | ||
| IHyperlink[] hyperlinks = new IHyperlink[fPositions.size()]; | ||
| for (int i = 0; i < fPositions.size(); i++) { | ||
| ConsoleHyperlinkPosition position = fPositions.get(i); |
| position= positions[mid]; | ||
| position = fPositions.get(mid); | ||
| if (offset < position.getOffset()) { | ||
| if (left == mid) { |
There was a problem hiding this comment.
wouldn't "?" operator be more compact here?
|
|
||
| mid = (left + right) / 2; | ||
| position = fPositions.get(mid); | ||
| if (position.getOffset() > offset) { |
There was a problem hiding this comment.
woulnd't "?" operator be more compact here?
|
This repository was merged with https://github.com/eclipse-platform/eclipse.platform if this PR is still relevant please rebase it and push it to the new origin! |
The console is slow when using unlimited console output with a lot of links.
This PR provides a faster implementation.
Use an internal list of positions that permit faster access, avoid
unnecessary copies and reduce memory consumption compared to IDocument
Position handling.
Here are some benchmarks for the execution of this code:
`
`
with unlimited console output:
--> almost impossible to scroll the console before this PR