# Interaction Between Caching and Benchmarking

**URL:** <https://discourse.julialang.org/t/interaction-between-caching-and-benchmarking/123935>\
**Category:** Profiling\
**Created:** [December 17, 2024, 8:00pm UTC](https://discourse.julialang.org/t/interaction-between-caching-and-benchmarking/123935 "2024-12-17T20:00:19Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [December 18, 2024, 5:06pm UTC](https://discourse.julialang.org/t/interaction-between-caching-and-benchmarking/123935/3 "2024-12-18T17:06:38Z")

</div>

One of my all-time favorite threads here was @foobar_lv2’s deep dive into how much different branch predictors can “learn” and remember during microbenchmarks:

> [@PSA: Microbenchmarks remember branch history](https://discourse.julialang.org/t/psa-microbenchmarks-remember-branch-history/17436):
>
> Something to keep in mind when running microbenchmarks: The sneaky CPU can remember astoundingly long branch history patterns. If you run @btime on somthing, then you generate a periodic branching pattern: The period length is the size of your benchmark, and it is repeated very often by the benchmark loop. This is because @btime runs your code multiple times and then averages the timings, because we don’t get clock with cycle-precision. This can spoil benchmarks and has affected some BaseBenchm…

---

_[View the full topic](https://discourse.julialang.org/t/interaction-between-caching-and-benchmarking/123935)._
