firenvim icon indicating copy to clipboard operation
firenvim copied to clipboard

Very slow when working with big textbox in Jupyter/Zepplin

Open GaryLiuTelus opened this issue 3 years ago • 8 comments

  • OS Version: win x86-64
  • Browser Version: Firefox 88.0
  • Browser Addon Version: 0.2.6
  • Neovim Plugin Version: 0.2.6
  • Neovim version 0.50
  • What I tried to do: I tried to use this plugin with Zeppelin and Jupyter Notebook.
  • What happened: It did well for smaller cells, but whenever it enters into a big cell with long code block (normally over screen height, i.e. some contents are outside screen), the speed is getting very very slow, especially when scroll up/down to show contents outside the screen. Firefox will give the warning to stop the page, as it slow down whole Firefox session.

Also, when the nvim instance is active in textbox A, and use mouse to click textbox B, the nvim instance in textbox A does not exit automatically. A explicit wq command is mandatory before jump to another textbox.

GaryLiuTelus avatar May 19 '21 16:05 GaryLiuTelus

This is surprising to hear, I'm getting 60 fps scrolling in fullscreen and that's with integrated graphics.

What is the size of the neovim frame in pixels? What CPU and GPU are you using? Can you reproduce the slowness in Chrome?

I'm also going to need you to record a performance profile. To do this, start Firenvim in a big cell and fill the buffer with data (e.g. fill the first line with ababab... and the second line with cdcdcd..., copy them with GGyG and paste them 10000 times with 10000p). Once the buffer is ready, visit https://profiler.firefox.com/ , enable the profiler, go back to the tab that contains Firenvim, reproduce the slowness for as long as possible and then stop the recording. This will open a new tab where you will find a button labeled "Upload Local Profile" in the top right corner. Click it, make sure all checkboxes are ticked, click "download" and upload the profile here.

glacambre avatar May 20 '21 17:05 glacambre

Firefox 2021-05-20 14.55 profile.json.gz Thanks for your quick response. Above is the profile. Please let me know if you need any further information.

This is done using Jupyter Notebook running at local server (localhost). The buffer loading is quicker than Zeppelin, which is a remote server. And it is slow especially scroll up/down to show contents outside screen.

GaryLiuGTA avatar May 20 '21 19:05 GaryLiuGTA

Please let me know if you need any further information.

I'd like to know what CPU & GPU you are using and the dimensions of the Firenvim frame in pixels :).

According to the performance profile you uploaded, the only slow thing is putImageData - that's the one thing Firenvim has to use to draw text, so I can't optimize anything there. It being slow makes me think that there might be an issue with your Firefox/driver/OS installation that is slowing things down. Could you try disabling (or enabling) hardware acceleration and seeing if it changes anything?

glacambre avatar May 21 '21 05:05 glacambre

CPU: Intel i7-6600U @2.6GHz GPU Intel HD 520 Firenvim frame size is roughly 24901439(I am using 2K2 monitor). even I worked on a smaller textbox, for every line I scroll beyond the current visible area, there is 0.5 to 1 second lag. I tried disabled hardware acceleration, but it does not help.

But using the same settings, it worked well on github (I am wrting this using firenvim). It just not worked well with web-based notebooks, such as Jupyter Notebook and Zeppelin. I am guessing it might because the textbox components are different from regular webpage textbox?

I can try this plugin in the other old laptop (with Ubuntu 20.04) during the weekend and see how it will go.

Thanks for your information!

GaryLiuTelus avatar May 21 '21 13:05 GaryLiuTelus

Hi, I tested in my old laptop, which has 3rd Gen i7 (i7 3250). And the firenvim ran very smoothly (I am replying this using firenvim on my old laptop now). I also tested in Jupyter Notebook, and pasted several thousands lines of text, and it is also vey fluent. So I guess there are something wrong with my new laptop. Thanks!

GaryLiuGTA avatar May 26 '21 01:05 GaryLiuGTA

Thank you for trying another machine - can you confirm that the dimensions of the Firenvim frame were the same?

glacambre avatar May 26 '21 04:05 glacambre

Yes, frame size is similar. And in the new laptop, the firenvim works fine in the regular small text box, such as those in Github, but every time after I use set lines = xxx to change the size, it became a little bit of sluggish. But this did happen in my old laptop. Still no idea why it happened, but it could be due to some settings in Firefox or OS (Ubuntu vs. Windows 10).

GaryLiuGTA avatar May 26 '21 15:05 GaryLiuGTA

In my cases, it takes about 1 minute to run :set lines=30 in a JupyterLab notebook cell even if the cell contains just 1 line of text.

dclong avatar Dec 13 '21 20:12 dclong