pastagang

pastagang blog

“performance” in pasta gang

no I’m not talking about “performing”

I’m talking about “performance” as in… how fast things run on your laptop or phone.




when jamming in tools like nudel and flok, the programs running can get pretty intense and it can start to run slow on your machine.

this can be sad because it might mean you can’t join in with the jam as fully as other people, or even worse… maybe not at all

as a jamming group, it’s our duty to make the jam “performant” enough so that every single person can access it. for me it’s crucial. in fact, it makes me quite cross sometimes because we are leaving so many people behind.

it can be easy for us all (me too) to get “excited” about brand new flashy “ideas” that seem cool but only make “performance” worse (both kinds)


at meetups, i see new joiners struggle to get things to run well on their laptop, and their phone, and i say sorry time and time again.

it’s not good enough! we need to stop saying we’ll do something and do something. we need to make the jam open to all.

this blog post is an attempt to wake people up about this, on behalf of all those who we exclude


what do we do

(tick when done and/or add new items to the list)



this blog post was written by pastagang in two beat style to keep it simple enough. all words longer than two beats were put in quotes

some more questions

there’s a huge stack to deal with here (layers of software) which is prob a big reason why things go slow. but web based is really cool and easy to get into.

while this might all sound a bit “pessimistic”, i think there is plenty of room for “optimization”. i think there are 2 major ways to tackle this:

so far

(edit if not true) (add also)

  1. target low hanging fruit;
    • css settings
    • other browser mischief
    • useful defaults
    • visual aids to performer
    • other js and worklet optimisations?
  2. investigation, measuring to find hotspots/bottlenecks
    • dev tools performance tab
    • repeatable benchmark patches
    • some kind of profiling tool or
    • dtrace/ebpf??
  3. developing custom approaches
    • compiling audio graphs (kabelsalat?)
    • wasm/assemblyscript?
    • external binaries?

long lived flok sessions

we’ve discovered that performance degrades with a longer lived flok session. this is one important aspect of pastagang: having a single room for everybody. the “pastagang” room was used first on december 30 2024 on todepond.cool/flok and one day later on nudel. at the time of this writing (feb 5 2025), the room is now over 2 months in (heavy) use. people have noticed things got slower when more people were in the same room. in particular, the syncing of the cursor movement seemed to be connected to it. even with only 2 people in a room, you could hold down the arrow keys to race through the code on one machine, to slow down the browser of another. the slowdown was most noticeable in the strudel clock, which missed events during cursor movement. we’ve tried turning off most features (no hydra, no strudel highlighting, no shaders, no kabelsalat), but still cursor movement was causing strudel clock callbacks to get delayed. the same phenomenon could be observed in both nudel and on flok.cc/s/pastagang. the slowdown didn’t happen anymore in a new room. this is why nudel now uses the pastagang2 room since today.

we haven’t fully understood why exactly this happens but, it has to be related to yjs and its “crdt” algorithm, which is used to sync people in a session. it seems that the longer a session lasts, the more memory is used for the editor history. i’m still not sure how exactly the storage of the session state is working, but one piece of the puzzle in the browser’s local indexDB. you can look up how big your indexDB is in the browser developer tools, (in chromium) going to application -> Storage. for me, it was around 5MB. i wanted to actually look at the data, but it seems the ui didn’t let me see all of it, so i found out how to log it from the browser console:

indexedDB.open("pastagang").onsuccess = function (event) {
  const db = event.target.result;
  const transaction = db.transaction("updates", "readonly");
  const store = transaction.objectStore("updates");
  const request = store.getAll();
  request.onsuccess = () => console.log(JSON.stringify(request.result).length);
  db.close();
};

the size i’m getting for this json is 48027941 characters, which is around 48MB! this is a lot, and seems plausible to have caused slowdowns. i even get dropped events when running this code in the console, because it takes so long to complete. when i run the same with pastagang2, i get a json of 195934, which is only 0.4% of the size. this means, we have to switch rooms regularly to preserver performance. there might be a fix that doesn’t involve manual labor, although changing the roomname once in a while is not a lot of maintenance. one idea by munshkr was that we could append a timestamp to the roomname. for example, we could use pastagang-${Math.floor(Date.now() / (1000 * 60 * 60 * 24))} to get a fresh room each 24 hours, or pastagang-${Math.floor(Date.now() / (1000 * 60 * 60 * 24 * 7))} to get a new one every week. lu had the idea to show a warning like “WARNING: JAM WILL BE PRUNED IN 60 SECONDS”. of course, there might also be a fix on the yjs or flok side to somehow prune the history automatically.