# Fast LogSumExp over 4th dimension

**URL:** https://discourse.julialang.org/t/fast-logsumexp-over-4th-dimension/64182
**Category:** Performance
**Tags:** tullio, loopvectorization
**Created:** [July 6, 2021, 11:21pm UTC](https://discourse.julialang.org/t/fast-logsumexp-over-4th-dimension/64182 "2021-07-06T23:21:30Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![jroon](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jroon](https://discourse.julialang.org/u/jroon)
#### Post date: [July 7, 2021, 12:57pm UTC](https://discourse.julialang.org/t/fast-logsumexp-over-4th-dimension/64182/5 "2021-07-07T12:57:56Z")

</div>

> [@dlakelan](#):
>
> The 4th version using tullio for everything seems like it’s quite good. fast and succinct. I’m not sure you’re going to get much better.

Ah that is surprising its basically my second time writing a Julia function (I’m familiar with numpy.einsum in Python though so that helps).

Hmm… I think then I’ll have to stick with my R version. Unless there is more improvement to be found here, the overhead of moving data from R to Julia which isn’t captured in my R benchmarks above that erases small benefits ([Fast 4D argmax - #23 by Non-Contradiction](https://discourse.julialang.org/t/fast-4d-argmax/58566/23))

---

_[View the full topic](https://discourse.julialang.org/t/fast-logsumexp-over-4th-dimension/64182)._
