# Correct way to benchmark StaticVectors

**URL:** <https://discourse.julialang.org/t/correct-way-to-benchmark-staticvectors/119357>\
**Category:** General Usage\
**Tags:** benchmarktools, staticarrays\
**Created:** [September 13, 2024, 12:26am UTC](https://discourse.julialang.org/t/correct-way-to-benchmark-staticvectors/119357 "2024-09-13T00:26:24Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)\
**Post date:** [September 13, 2024, 6:59am UTC](https://discourse.julialang.org/t/correct-way-to-benchmark-staticvectors/119357/4 "2024-09-13T06:59:49Z")

</div>

Benchmarking looks fine to me. Generally, timings `<1ns` are suspicious and indicate a complete constant-folding of your function. But here you are using StaticArrays.jl with vectors of size 3 so each function are just a handful of FLOPS and modern CPUs are quite fast 🙂

However this

> [@bthorne93](#):
>
> `det(A) ≈ 0`

is nonsense because it will always evaluate to `false` as just being discussed [in another thread](https://discourse.julialang.org/t/history-of-isapprox-in-languages/119347).  
You’ll need to think about an absolute scale, e.g. given by the largest element of `A` and then set `abstol` accordingly. Though I am not sure what “accordingly” should mean concretely when considering `det`. @stevengj probably has an idea what an appropriate scale should be. I would propose `abstol=sqrt(eps(eltype(A)))*maximum(A)`

---

_[View the full topic](https://discourse.julialang.org/t/correct-way-to-benchmark-staticvectors/119357)._
