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


##########
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:
   would you mind to share the performance/overhead number before and after 
this PR?
   
   The `ConcurrentHashMap` in Java8 indeed has a performance issue with 
`computeIfAbsent`.



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