Slow copy-from-Console with many links inside
If the console output contains many lines copying (ctrl+c) the output to clipboard becomes very slow. For example try to copy 100_000 lines already lags some seconds. Seems to be O(n^2) where n is number of lines. Example to reproduce a long console output :
public class Main {
public static void main(String[] args) {
for (int i = 0; i < 100_000; i++) {
System.out.println("org.eclipse.ui.console.TextConsoleViewer.findPosition(TextConsoleViewer.java:497)");
}
}
}
Almost all time is spend in org.eclipse.ui.console.TextConsoleViewer.findPosition(int, int, Position[])
The copied text is ~8MB:
Thank you for the good report, including taking the time to profile it.
I was able to reproduce it, I will take a look.
Note: it might be good to change the test to something like this:
System.out.println("START");
for (int i = 0; i < 100_000; i++) {
System.out.println("org.eclipse.ui.console.TextConsoleViewer.findPosition(TextConsoleViewer.java:497)");
}
System.out.println("STOP");
If someone else tries to reproduce it, make sure the the "Limit console output" is not checked.
(Settings -- Run / Debug -- Console, uncheck "Limit console output")
And make sure that the text in the console and the copied text has both START and STOP.
Otherwise the output is truncated, and looks much faster than it is.
The cause is very clear the style (link) applied on TextConsoleViewer.java:497.
That is detected as a possible file + line number and converted to a link.
Adding spaces around ':' (TextConsoleViewer.java : 497) makes it fast (but, of course, breaks the links)
I am not suggesting that this is a fix :-)
I was able to reproduce it, I will take a look.
cool.
Adding spaces around ':'
good point i will adapt the title