# Array views becoming dominant source of memory allocation

**URL:** <https://discourse.julialang.org/t/array-views-becoming-dominant-source-of-memory-allocation/6465>\
**Category:** Performance\
**Created:** [October 16, 2017, 11:31am UTC](https://discourse.julialang.org/t/array-views-becoming-dominant-source-of-memory-allocation/6465 "2017-10-16T11:31:24Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![foobar\_lv](https://avatars.discourse-cdn.com/v4/letter/f/35a633/32.png) [@foobar\_lv](https://discourse.julialang.org/u/foobar_lv)\
**Post date:** [October 16, 2017, 4:53pm UTC](https://discourse.julialang.org/t/array-views-becoming-dominant-source-of-memory-allocation/6465/8 "2017-10-16T16:53:04Z")

</div>

My attempt at speeding up such operations by using unsafe views failed at the speed of pointer-derefs for non-bitstypes; see [https://discourse.julialang.org/t/speed-and-type-stability-of-unsafe-pointer-to-objref/6478](https://discourse.julialang.org/t/speed-and-type-stability-of-unsafe-pointer-to-objref/6478).

The code there gets rid of the spurious allocations for the views, but pays too much on pointer-derefs.

This is somewhat similar to the other approach to unsafe views, but I changed the array type instead of mucking with SubArray. The code by @rdeits and @tkoolen is faster because you don’t pay overhead on unsafe\_load / unsafe\_store!.

---

_[View the full topic](https://discourse.julialang.org/t/array-views-becoming-dominant-source-of-memory-allocation/6465)._
