mach_absolute_timeon macOS. This is a portable way of returning the number of CPU cycles that works on both Intel- and ARM-based Macs.
mach_absolute_timeon macOS. While
mach_absolute_timehas nanosecond resolution on Intel-based Macs, this is not the case on ARM-based Macs, so the previous
mach_absolute_time-based implementation would return incorrect timing results on Apple silicon.
There are two minor consequences of this change:
criterion-measurementnow only supports macOS 10.02 or later, as that is the first version to have
clock_gettime_nsec_np. As macOS 10.02 was released in 2002, this is unlikely to affect users, but please speak up if this is a problem for you.
clock_gettime_nsec_npdoes not require any special initialization code,
criterion_inittimeis now a no-op on macOS. If you manually invoke the
getTimefunction in your code, however, it is still important that you
initializeTimebeforehand, as this is still required for the Windows implementation to work correctly.
- Ensure that
Criterion.Measurement.Types.Internalis always compiled with optimizations, even if the
criterion-measurementlibrary itself happens to be built with
-fprof-auto. This is necessary to ensure that the inner benchmarking loop of criterion always finishes in a timely manner, even if the rest of the library is not fully optimized.
whnfAppIOfunctions, which take a function and its argument separately like
whnf, but whose function returns
whnfIO. This is useful for benchmarking functions in which the bulk of the work is not bound by IO, but by pure computations that might otherwise be optimized away if the argument is known statically.
This is the first release of
criterion-measurement. The changelog notes below are copied from the notes for the corresponding
Move the measurement functionality of
criterioninto a standalone package,
criterion-measurement. In particular,
Criterion.Measurementare now in
criterion-measurement, along with the relevant definitions of
Criterion.Types.Internal(both of which are now under the
criterionnow depends on
This will let other libraries (e.g. alternative statistical analysis front-ends) to import the measurement functionality alone as a lightweight dependency.
Fix a bug on macOS and Windows where using
runAndAnalyseand other lower-level benchmarking functions would result in an infinite loop.