Rauzy fractals and delayed evaluation

Here’s a notebook I wrote on so-called Rauzy fractals:

I mention it here, in part, because I think it’s pretty cool. Also, though, it illustrates a difficulty that I occasionally run into. There are several examples built into the notebook specified by a radio button near the top. That radio button controls a lot of the subsequent output, much of which depends on time consuming computations that produces 2D and 3D graphics. Some of the output, particularly right near the radio button, should appear quite quickly but, generally, it seems that no cells resolve until all cells resolve.

Here’s an artificially constructed example of this kind of problem. If you foolishly press the “Don’t click!” button, you need to wait for a second or so for both cells to update, even though the first should be instantaneous:

The way I’ve dealt with this in the Rauzy fractal notebook is by delaying the evaluation of several of the most time consuming cells. That’s how the following works:

The Rauzy fractal notebook is much more complicated, though. While that delayed evaluation technique seems to help a lot, it’s still not ideal. I wonder if there’s a better approach?

Great notebook. I don’t know it was possible to create some fancy discrete fractals.

Your second solution is better, but you might do extra computation. You can try input debouncing: Debouncing Input / Mike Bostock | Observable

A fancier approach would be to provide a progressive rendering.

2 Likes

Glad to hear you like it @vvivanloc! And thanks for the pointer to Mike’s Debouncing Input notebook, too. It suggests that I might be able to try something with Generators at some point.