aokolnychyi commented on code in PR #8297:
URL: https://github.com/apache/iceberg/pull/8297#discussion_r1291710470


##########
api/src/main/java/org/apache/iceberg/metrics/DefaultCounter.java:
##########
@@ -63,7 +63,6 @@ public void increment() {
 
   @Override
   public void increment(long amount) {
-    Math.addExact(counter.longValue(), amount);

Review Comment:
   Calling `longValue()` on `LongAdd` is expensive as it performs an 
aggregation over cells. It basically removes all the benefits of `LongAdd` that 
is supposed to scale well in case of contention. We call it every time the 
counter is being modified. I am also not sure having an overflow (which is 
unlikely given that we are using longs) should fail queries, for instance. 
These are metrics and they should add as little overhead as possible.
   
   <img width="1508" alt="image" 
src="https://github.com/apache/iceberg/assets/6235869/23d90a49-b0b3-41bb-889e-a38c699f6132";>
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to