Class QuickTime
java.lang.Object
com.github.gbenroscience.parser.turbo.QuickTime
- Author:
- GBEMIRO
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface for the method to be timed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doublebenchmarkNano(String label, int warmups, int iterations, QuickTime.Timable task) Times a method over multiple iterations and returns the average.static voidreport(String label, QuickTime.Timable task) Prints a formatted report of the execution time.static longtimeNano(QuickTime.Timable task) Times a single execution of a method in nanoseconds.
-
Constructor Details
-
QuickTime
public QuickTime()
-
-
Method Details
-
timeNano
Times a single execution of a method in nanoseconds. Note: Single runs are susceptible to JIT "cold" overhead. * @param task The logic to time.- Returns:
- Execution time in nanoseconds.
-
benchmarkNano
public static double benchmarkNano(String label, int warmups, int iterations, QuickTime.Timable task) Times a method over multiple iterations and returns the average. This is better for benchmarking ParserNG logic.- Parameters:
label-warmups- Number of times to run the task.iterations- Number of times to run the task.task- The logic to time.- Returns:
- Average execution time in nanoseconds.
-
report
Prints a formatted report of the execution time.- Parameters:
label-task-
-