# Alternative to computation in a loop for distances for fast performance

**URL:** <https://discourse.julialang.org/t/alternative-to-computation-in-a-loop-for-distances-for-fast-performance/72642>\
**Category:** Performance\
**Created:** [December 6, 2021, 10:52am UTC](https://discourse.julialang.org/t/alternative-to-computation-in-a-loop-for-distances-for-fast-performance/72642 "2021-12-06T10:52:49Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [December 6, 2021, 12:06pm UTC](https://discourse.julialang.org/t/alternative-to-computation-in-a-loop-for-distances-for-fast-performance/72642/2 "2021-12-06T12:06:50Z")

</div>

Please make [an MWE](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757) and clarify what you mean by too much time.

Some potential low-hanging fruit could be removing allocations, using StaticArrays for your point vectors, and avoiding access to variables in global scope, but all of this is hard to tell without a working example.

---

_[View the full topic](https://discourse.julialang.org/t/alternative-to-computation-in-a-loop-for-distances-for-fast-performance/72642)._
