padenot / ringbuf.js

Wait-free thread-safe single-consumer single-producer ring buffer using SharedArrayBuffer
https://ringbuf-js.netlify.app/
Mozilla Public License 2.0
201 stars 18 forks source link

Fix instruction order to return early #26

Closed chrisguttandin closed 9 months ago

chrisguttandin commented 9 months ago

This PR just re-orders the capacity check inside ParameterWriter.enqueue_change() to avoid two unnecessary assignments in case it fails.

padenot commented 9 months ago

Thanks!