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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

pasting is very unperformant in CIDER #10687

Open
ara4n opened this issue Aug 28, 2019 · 7 comments
Open

pasting is very unperformant in CIDER #10687

ara4n opened this issue Aug 28, 2019 · 7 comments

Comments

@ara4n
Copy link
Member

ara4n commented Aug 28, 2019

i just tried to see how fast i could paste 馃帀 with slate, and it was pretty stable other than occasional GCs. On CIDER i can only manage a few per second, and it constantly GCs

@bwindels
Copy link
Contributor

bwindels commented Aug 29, 2019

Huh... this interesting. I can reproduce... sort off.

I can only reproduce in Chrome when the editor is quite narrow. When profiling this, the relayout takes~ 30ms and the CIDER code only ~1ms. I assume this is caused by the editor needing to grow in height frequently, and a relayout with the document as root is done for every paste. No GCs during any of this, although the javascript vm heap is only ~55mb while trying this, so maybe there is less memory pressure to GC.

I also get this while using Slate btw, so I'm likely seeing something else than you are.

When hitting ctrl+v, the first paste appears, and then the whole thing blocks until releasing the keys:
paste-tada

Could you perhaps pass me your profiling session file to compare?

@ara4n
Copy link
Member Author

ara4n commented Aug 29, 2019

https://matrix.org/_matrix/media/r0/download/matrix.org/dfSBwcLpjwfNqwzbsGHTutzr

(FF68 on macOS 10.14, the emoji appear very gradually, one by one, with about 300ms gap between).

This is when leaning on cmd-V to paste. It happens with emoji & non-emoji ftr.

@ara4n
Copy link
Member Author

ara4n commented Aug 29, 2019

btw, i don't think this is a very big deal - it's just that i was trying to benchmark it relative to Slate by pasting a lot of stuff, and got confused when it was ~20x slower to paste.

@bwindels
Copy link
Contributor

bwindels commented Aug 29, 2019

Ok, the provided recording doesn't clear up much :( I only see one input event being processed by CIDER, at the 7.288s mark, taking just around ~3ms to complete. Lots of react stack traces and worker messages in there as well, but hard to tell if related to the slowness. Maybe something else causing GCs is preventing the paste events from being dispatched? Firefox profiler sparseness also doesn't help here. If you can repro in Chrome, a recording from that browser could help.

@jryans
Copy link
Collaborator

jryans commented Aug 29, 2019

(The default Firefox profiler is near-useless, but a better one exists as an option in Firefox Nightly... The new profiling UI is a complete rewrite and loads the profile in a browser tab among many other features. I recommend it where possible as the profile viewer is much fancier, but it does involve using Nightly and checking "Enable new performance recorder" in DevTools settings. Unfortunately, I believe it uses a separate profile format, so we'd need a fresh profile to be recorded in the new tool to analyse it there.)

@bwindels
Copy link
Contributor

bwindels commented Aug 29, 2019

(The default Firefox profiler is near-useless, but a better one exists as an option in Firefox Nightly...

Indeed, must be a different format. Tried loading the file in nightly and gave me an identical result.

Edit: the new profile wasn't enabled in nightly actually, but the new one doesn't seem to have an option to load JSON files...

@jryans
Copy link
Collaborator

jryans commented Aug 30, 2019

Actually an even easier way to access the new Firefox profiler is via about:config setting "devtools.performance.new-panel-enabled" to true, as this will work in any release channel. Then go to DevTools and record in the performance panel.

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

4 participants