This extension allow running benchmarks using JMH in WarpScript.
For instance, if you want to benchmark the COS
function, you would run the following script:
// If you do not need pre/post macros,
// you can just push a macro instead of a map.
{
'preinvocation' <% RAND %>
'macro' <% COS %>
'postinvocation' <% DROP %>
}
// All the keys are optional in the following map
{
'mem' '64m'
'forks' 1
'warmupTime' '1 s'
'measurementTime' '1 s'
'timeUnit' 'MICROSECONDS'
}
// Run the benchmark. Be careful, it is usually quite long.
JMH
The given macro is the only code being benchmarked. If you need to configure the stack, store or push element on it without impacting the benchmark, you need to do that in Setup/TearDown macros associated to the following keys:
- pretrial
- preiteration
- preinvocation
- postinvocation
- postiteration
- posttrial
If postinvocation
is not set, it defaults to <% CLEAR %>
.
Valid keys are:
forks
measurementBatchSize
measurementIterations
measurementTime
mode
operationsPerInvocation
profilers
shouldDoGC
syncIterations
threads
cannot be used as stack are mono-threadedtimeUnit
warmupBatchSize
warmupForks
warmupIterations
warmupMode
warmupTime
mem
set memory using both -Xms and -Xmx