I want to benchmark 2 Libraries to evaluate them, with nearly Identical code.
But the issue is, that Java needs some Time to warm up.
Do you have any Idea how to properly set up a Benchmark, especially for "read write" operations with Java?
Its hard for me to grasp, how Java "warms up" or "cashes" Input data via streams.
My Usecase:
I read a template file. And fill it.
What I did:
Mesuring the Time of each Library to read a template and fill a document.
The issue I stumbled upon
In the first iteration the first library is significantly faster than the second one. But when I do like 1000+ iterations, they come out really close. I read the same tamplate file multiple times, that could be a issue.
Do you have any suggestions to create a realistic benchmark?
Because there is no Usecase, where 1000 Documents will be generated at once. But one per "workflow". But I need to take into account, that the JVM optimizes read data not only initialisation at runtime, and "is warmed up". And for how long it is warmed up, because since the usecase never includes multiple files at once, a "1000 iterations szenario" is not realistic.