3 ms·
What happens if you invert the test condition? That is, you run it 10k times and then see how long that took rather than for X time and see how many times you c
by renewiltord 5y ago
What happens if you invert the test condition? That is, you run it 10k times and then see how long that took rather than for X time and see how many times you could do it?
You’re using System.getCurrentTimeMillis() which should be w fast. My first thought was if you were using Instant and then sometimes there’s one call to VM.getNanoTimeAdjustment and sometimes two.
Man, this is a tough one. I’ll try when I’m home.
- cospaia 5y agoThanks! I’ll try this when I’m at the computer.
- cospaia 5y agoI added this experiment, and the results (spoiler, it isn't getCurrentTimeMillis) here: https://github.com/PEZ/ghost-chase-condition/tree/master/test-runs/timed-passes-10K https://github.com/PEZ/ghost-chase-condition/tree/master/tes...
- renewiltord 5y agoI suppose it was a bit of an unlikely idea. Thanks for following up.