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

Keyup events slow with large documents #654

Closed
waltonseymour opened this Issue Dec 11, 2016 · 6 comments

Comments

Projects
None yet
2 participants
@waltonseymour

waltonseymour commented Dec 11, 2016

Hi,

When using a sample text of Hamlet (link), each keystroke takes around 100ms, which is considerable slower than CKEditor.

I'm working with minified builds and running in production mode. My guess is that is has something to do with this event listener.

screen shot 2016-12-11 at 1 33 09 pm

Any suggestions for how to reduce this latency?

@waltonseymour

This comment has been minimized.

waltonseymour commented Dec 12, 2016

Interestingly, I don't notice any latency issues on the demo on http://alloyeditor.com

@ipeychev

This comment has been minimized.

Contributor

ipeychev commented Dec 12, 2016

Hello,

I added this text to our internal demo page and checked. It worked fine.
Therefore, it must be something specific for the environment where you noticed the issue. What is it? What is the browser? Have you added any additional plugins?

Thanks,

@waltonseymour

This comment has been minimized.

waltonseymour commented Dec 12, 2016

I'm using chromium and I haven't added any plugins. I can take a look at it later tonight and try to debug it a bit more.

Thanks.

@waltonseymour

This comment has been minimized.

waltonseymour commented Dec 15, 2016

After digging a bit, I've found a reproduction.

Simply pasting it in will result in raw text wrapped in a <pre> tag. If you convert the text to "normal", where each paragraph becomes a <p> tag, you'll notice the latency.

I've gotten this behavior on http://alloyeditor.com/ as well.

@ipeychev ipeychev added bug and removed help wanted question labels Dec 15, 2016

@ipeychev ipeychev closed this in e4f57d6 Dec 15, 2016

ipeychev added a commit that referenced this issue Dec 15, 2016

@ipeychev

This comment has been minimized.

Contributor

ipeychev commented Dec 15, 2016

Fixed, please see the commit message for more information.

Thanks for the report.

@ipeychev ipeychev added this to the 1.3.1 milestone Dec 16, 2016

@waltonseymour

This comment has been minimized.

waltonseymour commented Dec 16, 2016

Awesome, thanks

azotova added a commit to azotova/alloy-editor that referenced this issue Jan 7, 2017

Use innerText property instead getData
CKEditor's getData method is expensive to be invoked
on each keyup. It filters the data and when the text is large,
performance will suffer. For that reason a lightweight
method will be used - innerText property of the editable node

Fixes liferay#654

azotova added a commit to azotova/alloy-editor that referenced this issue Jan 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment