CLOVIS
09/23/2025, 2:27 PM-disableassertions under the profiler and I think the compiler isn't organizing the assertion code correctly.
As you can see, the profiler is able to measure a hot spot in the assertion evaluation even though it is not evaluated (even if it fails, nothing happens, as expected). I would expect the compiler to emit bytecode such that the JVM completely skips the entire expression if assertions are disabled (which is what Java does).jw
09/23/2025, 2:31 PM-Xassertions=jvm?CLOVIS
09/23/2025, 2:42 PMjw
09/23/2025, 2:42 PMCLOVIS
09/23/2025, 2:46 PMjw
09/23/2025, 2:49 PMjw
09/23/2025, 2:49 PMCLOVIS
09/23/2025, 2:53 PMobject AssertionUtils {
    val areAssertionsEnabled = this.javaClass.desiredAssertionStatus()
}
inline fun assert(message: () -> String, block: () -> Boolean) {
    if (AssertionUtils.areAssertionsEnabled) {
        if (!block()) {
            throw AssertionError(message())
        }
    }
}
and that way I don't see the intermediate expressions being executed