A Rubyist's Walk Along the C-side (Part 7): TypedData Objects - Peter Zhu
09-Dec-2021 1026
In the previous article, you saw how to define and use Ruby classes and modules through the C API. However, you might have noticed that for pretty much every operation, we needed to call into Ruby (e.g. reading and writing instance variables, calling methods, etc.). This, in many ways, defeats the purpose of writing a C extension since one of the goals of writing C extensions is to improve performance by relying on Ruby less. Spoiler alert: in a future article, we’ll use benchmarks to show that writing C extensions this way might actually be SLOWER than writing it in Ruby.
A Rubyist's Walk Along the C-side (Part 7): TypedData Objects - Peter Zhu #ruby #rubydeveloper #rubyonrails #Rubyist's #Along #C-side #(Part #TypedData #Objects #Peter #typeddata https://rubyonrails.ba/link/a-rubyist-s-walk-along-the-c-side-part-7-typeddata-objects-peter-zhu