# Summing arrays efficiently

**URL:** <https://discourse.julialang.org/t/summing-arrays-efficiently/15338>\
**Category:** Performance\
**Created:** [September 22, 2018, 12:43pm UTC](https://discourse.julialang.org/t/summing-arrays-efficiently/15338 "2018-09-22T12:43:58Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![bennedich](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bennedich/32/4894_2.png) [@bennedich](https://discourse.julialang.org/u/bennedich)\
**Post date:** [September 22, 2018, 2:16pm UTC](https://discourse.julialang.org/t/summing-arrays-efficiently/15338/8 "2018-09-22T14:16:18Z")

</div>

Thanks! That should work. I modified it to make it slightly more efficient:

```julia
julia> @btime reduce(⊕, view(A,2:length(A)), init=copy(A[1]));
  3.578 ms (8 allocations: 8.00 MiB)

```

---

_[View the full topic](https://discourse.julialang.org/t/summing-arrays-efficiently/15338)._
