A Clojure library providing local mutable variables with unsynchronized, unboxed performance for in-scope mutation.
Proteus is a Clojure library that provides local mutable variables through a macro called `let-mutable`. It solves performance issues in numerical and iterative operations by offering unsynchronized, unboxed mutable variables that are confined to a lexical scope, making them faster than Clojure's standard mutable references like atoms or volatiles.
Clojure developers working on performance-sensitive code, such as numerical computations, loops, or algorithms where mutable state within a limited scope can provide significant speed improvements.
Developers choose Proteus for its ability to deliver near-native performance for mutable operations while maintaining safety through scope confinement, avoiding the overhead of synchronization and boxing present in other Clojure mutable constructs.
local. mutable. variables.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Proteus avoids boxing numbers and uses unsynchronized operations, leading to significant speed improvements over Clojure's atoms or volatiles, as stated in the README for numerical and iterative tasks.
Variables are lexically scoped and cannot escape, ensuring no race conditions unless explicitly bypassed, which maintains functional safety while allowing mutability.
The library is exposed through a single macro, `proteus/let-mutable`, keeping the interface simple and focused, as highlighted in the README with minimal setup.
With the `:local` hint, mutable variables can serve as communication channels within closures like `swap!` calls, enabling advanced use cases without sacrificing performance.
Variables cannot escape local scope, making Proteus unsuitable for shared mutable state or concurrent systems, restricting its use to confined performance optimizations.
Misusing the `:local` hint on non-local closures can cause undefined behavior, with the README warning of 'strange, reality-defying effects,' posing a risk for developers.
The README is extremely concise, ending with 'That's it. That's the end of the library,' which may leave developers without guidance for complex scenarios or troubleshooting.