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.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle