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

Slow copy-from-Console with many links inside #1503

Open
jukzi opened this issue Aug 14, 2024 · 2 comments
Open

Slow copy-from-Console with many links inside #1503

jukzi opened this issue Aug 14, 2024 · 2 comments

Comments

@jukzi
Copy link
Contributor

jukzi commented Aug 14, 2024

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[])
image
The copied text is ~8MB:
image

@mihnita
Copy link
Contributor

mihnita commented Aug 14, 2024

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 :-)

@jukzi
Copy link
Contributor Author

jukzi commented Aug 15, 2024

I was able to reproduce it, I will take a look.

cool.

Adding spaces around ':'

good point i will adapt the title

@jukzi jukzi changed the title Slow copy-from-Console Slow copy-from-Console with many links inside Aug 15, 2024
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

2 participants