# Package to avoid allocations in some functions when using StaticArrays.jl

**URL:** <https://discourse.julialang.org/t/package-to-avoid-allocations-in-some-functions-when-using-staticarrays-jl/114539>\
**Category:** Performance\
**Tags:** package, memory-allocation\
**Created:** [May 22, 2024, 12:48am UTC](https://discourse.julialang.org/t/package-to-avoid-allocations-in-some-functions-when-using-staticarrays-jl/114539 "2024-05-22T00:48:06Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![Bruno\_Amorim](https://avatars.discourse-cdn.com/v4/letter/b/f6c823/32.png) [@Bruno\_Amorim](https://discourse.julialang.org/u/Bruno_Amorim)\
**Post date:** [May 25, 2024, 10:22am UTC](https://discourse.julialang.org/t/package-to-avoid-allocations-in-some-functions-when-using-staticarrays-jl/114539/16 "2024-05-25T10:22:56Z")

</div>

A possible compromise regarding type-piracy is to make it optional: exports a functions with a different name and provide an option to commit type-piracy.

This is what I have done in ThreadedSparseCSR.jl: [[ANN] Announcing ThreadedSparseCSR.jl](https://discourse.julialang.org/t/ann-announcing-threadedsparsecsr-jl/71343)

By default the package exports functions `tmul` and `bmul` which provide an aternative to `mul` and `*`. If one wishes to do so, the package provides the option to do type-piracy by overwriting `mul` and `*` by `tmul` or `bmul`

---

_[View the full topic](https://discourse.julialang.org/t/package-to-avoid-allocations-in-some-functions-when-using-staticarrays-jl/114539)._
