O'Reilly logo

Addison-Wesley Professional Ruby Series Writing Efficient Ruby Code by Dr. Stefan Kaes

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter . Runtime Complexity of Ruby Language Constructs

Ruby is a highly dynamic language: Almost all language entities are first-class citizens in that they can be created, changed, and destroyed at runtime. This comprises classes, modules, methods, constants, and class and instance variables. Only local variables are second-class citizens in Ruby: Whether a name refers to a local variable is determined at parse time.

Not surprisingly, this flexibility has implications in terms of performance: It is impossible to bind a given name to a fixed memory address (or to a fixed relative offset in a relocation table) at program load time. Thus, whenever a name is used in Ruby code, the Ruby interpreter needs to search for the object to which the code ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required