Fokko commented on code in PR #8082:
URL: https://github.com/apache/iceberg/pull/8082#discussion_r1268471870


##########
python/pyiceberg/typedef.py:
##########
@@ -127,18 +127,23 @@ def json(self, exclude_none: bool = True, exclude: 
Optional[Set[str]] = None, by
         )
 
 
+CACHED_STRUCT_TO_FIELD_NAME_POSITIONS: Dict[StructType, List[str]] = {}
+
+
 class Record(StructProtocol):
     __slots__ = ("_position_to_field_name",)
-    _position_to_field_name: Dict[int, str]
+    _position_to_field_name: List[str]

Review Comment:
   ```suggestion
       _position_to_field_name: Tuple[str]
   ```
   
   What do you think of turning this into a tuple, that has two benefits:
   
   1. Smaller in memory
   2. Immutable
   
   ```python
   >>> import sys
   >>> sys.getsizeof(list(range(1925)))
   15456
   >>> sys.getsizeof(tuple(range(1925)))
   15440
   ```



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