Implementing Embedded TypedData Objects | Rails at Scale
06-Jun-2025 55
Internally, CRuby’s objects are strongly typed, with various types such as Array, Hash, Regexp, and Object. There is also a type called TypedData which is a data type used internally and by native gems to store a native pointer to an arbitrary piece of data. Some types in Ruby that are TypedData objects include Time, Mutex, and Enumerator. Native extensions like Nokogiri, pg, mysql2, and liquid-c also use TypedData objects extensively.
Jean Boussier and I implemented TypedData objects on Variable Width Allocation in Ruby 3.3, which improves performance and memory usage. In this blog post, we will explore what TypedData objects are, how the memory layout changes with embedded TypedData objects, and our progress with implementing types on TypedData objects.
Implementing Embedded TypedData Objects | Rails at Scale #ruby #rubydeveloper #rubyonrails #Implementing #Embedded #TypedData #Objects #Rails #Scale #typeddata https://www.rubyonrails.ba/link/implementing-embedded-typeddata-objects-rails-at-scale