-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
performanceMust go fasterMust go faster
Description
For e.g. benchmarking purposes it would be convenient to have a @noopt
macro or something that would instruct the compiler not to optimize something. For example, the google benchmark suite has the following code
// The DoNotOptimize(...) function can be used to prevent a value or
// expression from being optimized away by the compiler. This function is
// intended to add little to no overhead.
// See: https://youtu.be/nXaxk27zwlk?t=2441
#ifndef BENCHMARK_HAS_NO_INLINE_ASSEMBLY
template <class Tp>
inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp const& value) {
asm volatile("" : : "r,m"(value) : "memory");
}
(also see https://www.youtube.com/watch?v=nXaxk27zwlk&feature=youtu.be&t=2441 as the comment links to)
It would be useful to have something similar in Julia.
musm and zgornel
Metadata
Metadata
Assignees
Labels
performanceMust go fasterMust go faster