[ 
https://issues.apache.org/jira/browse/BEAM-13015?focusedWorklogId=745436&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-745436
 ]

ASF GitHub Bot logged work on BEAM-13015:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 21/Mar/22 21:21
            Start Date: 21/Mar/22 21:21
    Worklog Time Spent: 10m 
      Work Description: lukecwik commented on a change in pull request #17121:
URL: https://github.com/apache/beam/pull/17121#discussion_r831553441



##########
File path: 
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/state/StateFetchingIterators.java
##########
@@ -84,12 +84,27 @@ private StateFetchingIterators() {}
       StateRequest stateRequestForFirstChunk,
       Coder<T> valueCoder) {
     return new CachingStateIterable<>(
-        (Cache<StateKey, Blocks<T>>) cache,
+        (Cache<IterableCacheKey, Blocks<T>>) cache,
         beamFnStateClient,
         stateRequestForFirstChunk,
         valueCoder);
   }
 
+  @VisibleForTesting
+  static class IterableCacheKey implements Weighted {
+    private IterableCacheKey() {}
+
+    static final IterableCacheKey INSTANCE = new IterableCacheKey();
+
+    @Override
+    public long getWeight() {
+      // Ignore the actual size of this singleton because it is trivial and 
because
+      // the weight reported here will be counted many times as it is present 
in
+      // many different state subcaches.
+      return 0;

Review comment:
       The reference to the object still matters as a key even though there are 
many copies.
   
   I would still suggest weighing an instance and storing that statically or if 
there is a way to look up the cost of a pointer via JAMM or the JVM.




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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 745436)
    Time Spent: 70h 20m  (was: 70h 10m)

> Optimize Java SDK harness
> -------------------------
>
>                 Key: BEAM-13015
>                 URL: https://issues.apache.org/jira/browse/BEAM-13015
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-java-harness
>            Reporter: Luke Cwik
>            Assignee: Luke Cwik
>            Priority: P2
>          Time Spent: 70h 20m
>  Remaining Estimate: 0h
>
> Use profiling tools to remove bundle processing overhead in the SDK harness.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to