Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Exception Cost Test - C

Author

anonymous

about 2 years ago

Language

C

Compiler

gcc 12.2.0

Options
Warnings
Optimization
C11(GNU)
no pedantic

Exception Cost Test - C

Author

anonymous

about 2 years ago

$ gcc prog.c -Wall -Wextra -O2 -march=native -std=gnu11
prog.c: In function 'measure_no_exception_cost':
prog.c:60:14: warning: variable 'i' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered]
   60 |     for (int i = 0; i < N; i++) {
      |              ^
measureNoExceptionCost: Exceptions: 0, NoExceptions: 100000000, Duration: 354.38 ms
measureExceptionCost: Probability: 0.00%, Exceptions: 0, NoExceptions: 100000000, Duration: 408.00 ms
measureExceptionCost: Probability: 1.00%, Exceptions: 1000361, NoExceptions: 98999639, Duration: 424.00 ms
measureExceptionCost: Probability: 99.00%, Exceptions: 98999886, NoExceptions: 1000114, Duration: 704.00 ms
Exit Code:
0