devdocs
devdocs copied to clipboard
Resizing the sidebar is atrociously slow
Bug report
OS information
Windows 10, Chrome 90
Steps to reproduce
Grab the sidebar boundary and try to resize it. The result is incredibly slow and there is a spike in CPU usage.
Thanks for the report, I've reproduced this on my machine. Scrolling has a similar affect on CPU usage, though it seems smooth to me.
Sorry, missclicked - I just meant to comment!
Yeah, scrolling the sidebar is fine for me too. I noticed one other thing: docs for a specific framework/language, like lodash, are 10x slower than the main page. Try resizing the sidebar here and you'll probably see it's even worse: https://devdocs.io/lodash/
I've been testing this, the way the sidebar is implemeted is what makes it so cpu hungry.
The sidebar uses the drag
event to calculate the size while dragging, when the drag is started it polls every few milliseconds for any cursor movement and the event is handled each time the cursors is moved by one pixel. The sidebar makes a lot of work like add new size of the sizebar in the cookies, change the size of the entries bar, change the value of the --sidebarWidth
property of the html
tag and more; this is done each time the cursor is moved by pixel.
I tried to reproduce this but the outcome was the same, a sidebar with a lot of cpu usage, even though it was only the sidebar and nothing else.
I do not know yet why the sidebar uses more resources depending on the documentation, but I think it would be better to change the way the sidebar is implemented first.