Cables

Cables

Cables, buffers, stacks, and pools. These are what Patchwerk uses under the hood to efficiently copy data. In the wrong hands, it can be quite a footgun!

Notes and noodling for now. Will write more later.

Some under-the-hood talk

TODO bhold/bunhold

TODO cabset/cabget

TODO cabclr

TODO cabnew

cabtmp

Like cabnew, but it will first try to get a buffer from the pool before allocating a buffer as a last resort.

Here is a stress test that demonstrates this.

patchwerk nodes

# use up all 8 buffers (default pool size)

440 0.5 sine cabtmp
440 0.5 sine cabtmp
440 0.5 sine cabtmp
440 0.5 sine cabtmp
440 0.5 sine cabtmp
440 0.5 sine cabtmp
440 0.5 sine cabtmp
440 0.5 sine cabtmp

# this one allocates a buffer
440 0.5 sine cabtmp