KarmaGYZ commented on a change in pull request #14897:
URL: https://github.com/apache/flink/pull/14897#discussion_r572511815



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/util/ResourceCounter.java
##########
@@ -35,11 +37,12 @@
  * associated counts. The counts are always positive (> 0).
  */
 public final class ResourceCounter {

Review comment:
       I make it mutable mainly for performance concerns. If someone uses it 
like a "counter", `add` and `substract` resource profile for a lot of times, 
the construct of `ResourceCounter` might be expensive. It may also put a lot of 
pressure on the GC. For instance, every time a slot is allocated, we will 
construct 2 `ResourceCounter`s in `ResourceTracker#notifyAcquiredResource`.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to