[PyROOT] Importing ROOT in JupyterLab reduces kernel performance
After importing ROOT in a Jupyter Notebook in which Jupyter Widgets are used, the performance of figure interactions like panning and zooming drastically falls off. After identifying ROOT as the culprit, I found that the poor performance is caused by sleeping invoked during these hooks which are run for each kernel execution.
OK, I created an implementation of a non-blocking equivalent. I'm sure there are some bugs:
This notebook uses a thread-based trampoline to execute the various blocking waits without interrupting the kernel. The results are displayed asynchronously using the ZMQ event loop (used by the kernel), and the executing cell's context is temporarily restored to ensure results end up (visually) in the right place.
Clearly this would need some more work to replace the existing contents of JupyROOT.helpers.utils, but I hope that it's a starting point for discussion
Run all cells in each notebook, and then look at the coordinates in the status-bar as the cursor moves over the plot. In the un-patched case, the input lag increases with time (as more messages are buffered behind the calls to sleep).
@agoose77 thank you very much for this extensive research you did!
Do you think you could apply this to JupyROOT.helpers.utils?
@etejedor sure, I'll add this to my TODO list :)