clerk 2024-01-08

Hi. I'm new to clerk. My main browser is Firefox, but with a growing notebook with 4-6 figures it got really slow. So I tried turning off the file watcher, which forced me to run refresh each time I wanted to see changes, but the time between refresh and final content is still about 30 seconds, when it works. Sometimes I just get error messages, or Firefox just freezes up and I have to wait. Chrome seems more stable, but now the show! function doesn't work anymore because the default browser is Firefox. I really like how fast it is to get graphs going with clerk. Is there some performance things I can tune? (system: WSL2 with clojure 1.12 alpha 5, java 21, clerk 0.15.957) using vega lite. Browser in windows. Added a screenshot of the profiler. Dunno if that helps. Switching to chrome is only helping a little bit, and I'm losing my REPL workflow with instant updates. Anybody got any perf tips?

Some of your performance issues might depend on how much data you're sending to the browser via clerk/vl. If you have a large CSV or JSON (or other) dataset that you're repeatedly sending over the wire using something like {:values [...]} it can certainly incur a performance penalty, particularly if you're just displaying an aggregation or summary of that data. I try to avoid this by precomputing my aggregations on the Clojure side and doing less work using Vega's built-in aggregations and transformations.

Not that much data. 43k rows preprocessed with 3 columns. takes less than a second to render in the vega editor.

FWIW, I have also encountered difficult-to-reproduce performance issues with notebook display on Firefox, including a large gap between evaluation of the final cell and actual page display, as you describe.

Ok. I don't know enough about the Clerk stack to mod it. So right now it kind of feels like magic. For data exploration maybe it could be feasible to render the data with N parallel v2png (local render) calls instead.. and then switch to the clerk/vl when I want the interactivity. A bit of a hack though..

https://github.com/applied-science/darkstar I've used Darkstar for a similar purpose in the past.

Cool! I will take a look