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

selectRange() is very slow #99

Closed
ghost opened this issue Nov 25, 2014 · 5 comments
Closed

selectRange() is very slow #99

ghost opened this issue Nov 25, 2014 · 5 comments
Labels

Comments

@ghost
Copy link

ghost commented Nov 25, 2014

Since there is no way of scrolling at the moment (see bug #98), I am using a workaround os selectRange(index,index). However, this is very slow.

In a 4800 lines file with 3 different styles per line, it takes more than 6 seconds to perform the operation on a Intel core i7 machine.

    long nanoTime = System.nanoTime();
    codeArea.selectRange(codeArea.getText().length(), codeArea.getText().length());
    System.out.println(System.nanoTime() - nanoTime);
@TomasMikula
Copy link
Member

Note that codeArea.getText() involves concatenating all the paragraphs. If you have 4800 lines, each containing 3 segments of styled text, that means concatenating 19200 strings (the 3 segments + newline per paragraph). Although this could (and should) be improved, if you don't need the actual text, but only its length, use codeArea.getLength() instead. Let me know whether and how much this improved your situation.

@ghost
Copy link
Author

ghost commented Nov 26, 2014

Thanks fo the reply. In fact I don't need the text at this time. Unfortunately it does not really improve performance (6.4 sec --> 6.3 sec).

@TomasMikula
Copy link
Member

This is fixed in version 0.6.2. Sorry it took so long.

@TomasMikula
Copy link
Member

Thanks, I fixed the links.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant