Copilot commented on code in PR #3866:
URL: https://github.com/apache/avro/pull/3866#discussion_r3567560120


##########
lang/js/lib/schemas.js:
##########
@@ -1203,6 +1259,8 @@ MapType.prototype._match = function () {
 MapType.prototype._updateResolver = function (resolver, type, opts) {
   if (type instanceof MapType) {
     resolver._values = this._values.createResolver(type._values, opts);
+    // Bound the block count using the writer's entry size (see ArrayType).
+    resolver._valuesMinBytes = 1 + getMinBytes(type._values);
     resolver._read = this._read;

Review Comment:
   `Resolver`'s constructor explicitly predefines fields so all resolvers share 
the same hidden class (see `function Resolver(readerType)` later in this file). 
Adding new properties here (`_valuesMinBytes`, and similarly `_itemsMinBytes` 
in `ArrayType._updateResolver`) defeats that optimization and can cause extra 
hidden-class transitions in V8. Consider predeclaring these fields in the 
`Resolver` constructor (initialized to `undefined`/`null`) so the shape remains 
stable.



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

Reply via email to