att / rcloud

Collaborative data analysis and visualization
http://rcloud.social
MIT License
430 stars 142 forks source link

busy waiting for cell content #2619

Closed gordonwoodhull closed 5 years ago

gordonwoodhull commented 5 years ago

I was looking for the source of https://github.com/att/rcloud.params/issues/12 so I did the stupid person's profiling method and ran a blocking rcloud.params cell, and paused it randomly a few times in the debugger to see where it's taking up so much CPU (>70% in this case)

It looks like if wait_for_content does not find the html widget or whatever it's looking for (why does cell_view know about htmlwidgets?) it will go into a callback loop.

gordonwoodhull commented 5 years ago

I think the above commit removing some busy waits did help CPU usage a bit for rcloud.params.

When investigating, @useless5771 said that readline also took a lot of CPU. I investigated that and found that it was jQuery $.animate() for the input border. Which is just weird - maybe it is causing reflow or something.

Using d3 there brings CPU usage from 98% to 10-20%.

The throbbing play button and the spinning cell status animations account for the rest of excess CPU usage while waiting for input.

I'm replacing the play button animation with a d3 implementation because the rhythm is better.