-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document checksum behavior and how to opt out (#20)
- Loading branch information
1 parent
170f73c
commit 1e13aab
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,6 +75,32 @@ julia> @b rand(100) sort(_, by=x -> exp(-x)) issorted(_, rev=true) || error() | |
|
||
See [`@b`](@ref) for more info | ||
|
||
## Truthful | ||
|
||
Charimarks.jl automatically computes a checksum based on the results of the provided | ||
computations, and returns that checksum to the user along with benchmark results. This makes | ||
it impossible for the compiler to elide any part of the computation that has an impact on | ||
its return value. | ||
|
||
While the checksums are fast, one negative side effect of this is that they add a bit of | ||
overhead to the measured runtime, and that overhead can vary depending on the function being | ||
benchmarked. These checksums are performed by computing a map over the returned values and a | ||
reduction over those mapped values. You can disable this by overwriting the map with | ||
something trivial. For example, `map=Returns(nothing)`, possibly in combination with a | ||
custom teardown function that verifies computation results. Be aware that as the compiler | ||
improves, it may become better at eliding benchmarks whose results are not saved. | ||
|
||
```jldoctest; filters=r"\d\d?\d?\.\d{3} [μmn]?s( \(.*\))?|0 ns|<0.001 ns" | ||
Check failure on line 93 in docs/src/index.md GitHub Actions / Documentation
|
||
julia> @b 1 | ||
0.713 ns | ||
julia> @b 1.0 | ||
1.135 ns | ||
julia> @b 1.0 map=Returns(nothing) | ||
0 ns | ||
``` | ||
|
||
## Efficient | ||
|
||
| | Chairmarks.jl | BenchmarkTools.jl | Ratio | ||
|