There's a big comment at the top of context.js that details a bunch of big and little improvements we could make to this, they include...
[ ] We make pretty heavy use of array methods like reduce, map, filter, etc. These are objectively slower than traditional iteration using for loops so we can probably see some immediate performance gains by switching to this.
[ ] We also end up repeating quite a lot of this iteration instead of saving the results and reusing them. This happens all over the place in the diffing algorithm; we"ll filter the list of previous keys for ones not present in the current graph, then we"ll filter the current keys for ones not present in the previous graph even though we can already work that out from what we already know.
[ ] We only support a subset of the Web Audio API. Specifically, we don"t support buffer sources so playing audio files is out of the question. That kind of sucks and I expect it will be dealbreaker for those seriously considering adopting this library for their own code.
[ ] We also don"t support custom or external audio nodes like those provided by tone.js or tuna. This isn"t particularly horrible to implement, fortunately they will all abide by the same basic AudioNode api, so allowing developers to extend the VirtualAudioContext with knowledge of these nodes would be really nice.
Beyond these there's also one big one that I didn't put down in a comment.
[ ] We're doing some super ad-hoc semi-graph based thing, when we could be doing Very Standard graph traversals and diffs by just producing an array of nodes and an array of edges. I suspect this would be a huge win to both perf and maintainability if we were to implement this properly.
There's a big comment at the top of
context.js
that details a bunch of big and little improvements we could make to this, they include...reduce
,map
,filter
, etc. These are objectively slower than traditional iteration usingfor
loops so we can probably see some immediate performance gains by switching to this.Beyond these there's also one big one that I didn't put down in a comment.