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


##########
core/src/main/java/org/apache/iceberg/DeleteFileIndex.java:
##########
@@ -117,13 +117,18 @@ public Iterable<DeleteFile> referencedDeleteFiles() {
     return deleteFiles;
   }
 
-  private StructLikeWrapper newWrapper(int specId) {
-    return StructLikeWrapper.forType(partitionTypeById.get(specId));
+  private Map<Integer, ThreadLocal<StructLikeWrapper>> wrappers(Map<Integer, 
PartitionSpec> specs) {
+    Map<Integer, ThreadLocal<StructLikeWrapper>> wrappers = Maps.newHashMap();
+    specs.forEach((specId, spec) -> wrappers.put(specId, newWrapper(specId)));
+    return wrappers;
+  }
+
+  private ThreadLocal<StructLikeWrapper> newWrapper(int specId) {
+    return ThreadLocal.withInitial(() -> 
StructLikeWrapper.forType(partitionTypeById.get(specId)));
   }
 
   private Pair<Integer, StructLikeWrapper> partition(int specId, StructLike 
struct) {
-    ThreadLocal<StructLikeWrapper> wrapper =
-        wrapperById.computeIfAbsent(specId, id -> ThreadLocal.withInitial(() 
-> newWrapper(id)));

Review Comment:
   Yeah, we discussed that issue in a previous PR. I doubt the performance 
difference would be visible now given that we read manifest entries locally 
(there is non-trivial cost for decoding and other things that dominates). I 
noticed it when profiling distributed planning where all the data files are 
already loaded in memory. It is not critical, but it appeared on a few 
flamegraphs (I was using Java 8).
   
   I just don't really see value in `ConcurrentHashMap` in this use case.
   



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