Skip to content

Commit

Permalink
[Internal] Micro-optimisation: Reuse previously calculated `java.lang…
Browse files Browse the repository at this point in the history
…System.nanoTime` (#1407)

Hey :)

I'm not contributing much anymore. Sorry about that. I lost the
motivation, TBH, but I really enjoy following what you continue to do 👏

I was passing by and was reading some of the new code when I saw this.
LMKWYT :)

With this change, we lose some nanoseconds of precision, so it might not
be the expected behaviour. 🤔
  • Loading branch information
guizmaii authored Nov 26, 2024
1 parent 5f371c6 commit b861c99
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ private[consumer] final class Runloop private (
for {
p <- Promise.make[Throwable, Unit]
startTime = java.lang.System.nanoTime()
_ <- commitQueue.offer(Runloop.Commit(java.lang.System.nanoTime(), offsets, p))
_ <- commitQueue.offer(Runloop.Commit(startTime, offsets, p))
_ <- commandQueue.offer(RunloopCommand.CommitAvailable)
_ <- diagnostics.emit(DiagnosticEvent.Commit.Started(offsets))
_ <- p.await.timeoutFail(CommitTimeout)(commitTimeout)
Expand Down

0 comments on commit b861c99

Please sign in to comment.