My main instinct is that it’s going to be very hard for us to add anything more useful than what your browser inspector already provides. I assume that you’ve already tried your browser performance profiler on your notebook? Even running in the sub-frame, notebooks are pretty easy to profile, use the debugger, and so on.
For example, running it on my old earthquakes notebook shows me that I’m allocating a lot of JS objects that I shouldn’t be, if I want to avoid GC pauses:
Is there a documentation of where to find the objects managed by Observable in the browser developpers tools? For example: how to print the value of a cell in the console?
The Observable runtime doesn’t expose the graph of cells as global variables, but you can certainly log the value of any cell to the console from within a notebook. Because of the reactive runtime, it will even re-log the cells value whenever it changes:
Thanks. I already use that way, but I wondered if it would be possible to inspect any of the variables directly from the console, without console.log().
What is the reason to hide the variables?
Probably the reason is my own limitations with the profiler. On your earthquakes page, for example, I don’t know where to read the names of the functions involved (those that have this red-ear marker). Everything seems hidden in “observable workers”. I’ll dig more.
Jeremy’s picture might not be the easiest screencap to see what you are looking for. Here’s the Chrome dev tools timeline with a “bottom up” tree of one animation frame.
Part of the difficulty may be that you get a mix of anonymous functions and minified names, so it’s a bit hard to guess what the functions are actually about. If you loaded an unminified version of D3 it would probably be clearer
@Fil — I think you’re right about this. I too have trouble peering inside of the inspector to see what’s going on within the “micro task” promise callbacks that serve as the bodies of your cells being evaluated.
For example, in Chrome, I can’t see within the “Run Microtasks” and “Animation Frame Fired” activity to see the names of the function being called, that take up most of the run time:
The call tree is a little more helpful at telling you where the expensive calls are coming from — but still fundamentally points back at an eval() in minified source code:
Okay weird, now I can’t get back to my previous screenshot either.
Maybe Chrome updated itself between then and now, and the new version has a less useful profiler? I’m not quite sure what happened, but I don’t have time to figure it out right now…