@Benchmark public long systematicallyReadWrite() { long time = System.nanoTime(); long kudos = player.getKudos(); long points = player.getPoints(); player.update(points + time, kudos + points); return player.getKudos(); }
@Benchmark public long readOnly() { long time = System.nanoTime(); if (time % 2 == 0) { return player.getKudos(); } else { return player.getPoints(); } }
@Benchmark public long randomlyReadWrite() { long time = System.nanoTime(); if (time % 2 == 0) { return player.getPoints(); } else { if (time % 9 == 0) { player.update(time, time + 1); return 0l; } else { return player.getKudos(); } } }
@Benchmark public void writeOnly() { long time = System.nanoTime(); player.update(time + 1, time - 1); }