This is an automated email from the ASF dual-hosted git repository.

tjwp pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/branch-1.11 by this push:
     new 7d797ccc0 AVRO-3722: [Ruby] Eagerly initialize instance variables for 
better inline cache hits (#2132)
7d797ccc0 is described below

commit 7d797ccc0944f9e7558e8e94ec41a8c43ae82313
Author: Aaron Patterson <[email protected]>
AuthorDate: Wed Mar 8 09:54:13 2023 -0800

    AVRO-3722: [Ruby] Eagerly initialize instance variables for better inline 
cache hits (#2132)
    
    Eagerly initialize the `@type_adapter` instance variable to `nil` to see 
better inline cache hits
---
 lang/ruby/lib/avro/schema.rb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lang/ruby/lib/avro/schema.rb b/lang/ruby/lib/avro/schema.rb
index 0b4c04f33..4485d5e9e 100644
--- a/lang/ruby/lib/avro/schema.rb
+++ b/lang/ruby/lib/avro/schema.rb
@@ -126,6 +126,7 @@ module Avro
     def initialize(type, logical_type=nil)
       @type_sym = type.is_a?(Symbol) ? type : type.to_sym
       @logical_type = logical_type
+      @type_adapter = nil
     end
 
     attr_reader :type_sym
@@ -571,6 +572,7 @@ module Avro
         @order = order
         @doc = doc
         @aliases = aliases
+        @type_adapter = nil
         validate_aliases! if aliases
         validate_default! if default? && !Avro.disable_field_default_validation
       end

Reply via email to