# Why isn't minmax branchless?

**URL:** <https://discourse.julialang.org/t/why-isnt-minmax-branchless/64854>\
**Category:** Internals & Design\
**Created:** [July 18, 2021, 11:27am UTC](https://discourse.julialang.org/t/why-isnt-minmax-branchless/64854 "2021-07-18T11:27:57Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [July 19, 2021, 6:41am UTC](https://discourse.julialang.org/t/why-isnt-minmax-branchless/64854/12 "2021-07-19T06:41:23Z")

</div>

I think your benchmark is skewed by the fact that you’re always using the same data. The branch predictor in your CPU is [probably picking up the patterns in your data](https://discourse.julialang.org/t/psa-microbenchmarks-remember-branch-history/17436) and messing with your result. I’d create a new array for each benchmark run using the `setup` keyword of `@benchmark`. It should still even out statistically, but it’ll make it much harder for the branch predictor to mess with things.

---

_[View the full topic](https://discourse.julialang.org/t/why-isnt-minmax-branchless/64854)._
