# Why is Julia's performance more sensitive to memory allocations than Numpy's?

**URL:** <https://discourse.julialang.org/t/why-is-julias-performance-more-sensitive-to-memory-allocations-than-numpys/119013>\
**Category:** Performance\
**Created:** [September 3, 2024, 11:07pm UTC](https://discourse.julialang.org/t/why-is-julias-performance-more-sensitive-to-memory-allocations-than-numpys/119013 "2024-09-03T23:07:24Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [September 3, 2024, 11:17pm UTC](https://discourse.julialang.org/t/why-is-julias-performance-more-sensitive-to-memory-allocations-than-numpys/119013/2 "2024-09-03T23:17:14Z")

</div>

> [@maxkapur](#):
>
> the sort of fine-toothed “avoid every possible allocation” advice that is so often  
> repeated on the Julia forum. It seems to me that Numpy just has a different  
> performance model than Julia in which the stray allocation here and there simply  
> isn’t that big of a deal.

It’s a rule of thumb, is true, while allocations in loops can be fast as a workaround with:

> **[GitHub - MasonProtter/Bumper.jl: Bring Your Own Stack](https://github.com/MasonProtter/Bumper.jl)**
>
> Bring Your Own Stack

Besides Libc.malloc and free, in Julia’s stdlib, there’s also:

> **[GitHub - JuliaSIMD/ManualMemory.jl: Manual memory management utilities.](https://github.com/JuliaSIMD/ManualMemory.jl)**
>
> Manual memory management utilities.

> [@Can I manage the memory by myself?](https://discourse.julialang.org/t/can-i-manage-the-memory-by-myself/97250):
>
> I have a code, the GC live and RSS memory increased quickly when running, while I don’t need such big memory to do basic computation. I need to allocate lots of small dict for intermidiate computing before, and the memory increase quickly; to avoid memory allocation, I pre-allocate two array to avoid repeatly allocate small dict, it put off the invreasing. But still get lots of allocation when I repeatly add some sparse array to get final one. I am tired of avoiding allocation, and I guess memo…

---

_[View the full topic](https://discourse.julialang.org/t/why-is-julias-performance-more-sensitive-to-memory-allocations-than-numpys/119013)._
