Re:Why Python Is Slow: Looking Under the Hood
by chrisseaton on Tuesday November 18, 2014 @09:16PM
(#8627841)
I think the very real risk here is that you think you're adding those slower fallback features just for edge cases, but in reality they get used in the majority of cases.
I believe that some code paths critical for performance in Rails use metaprogramming, for example.
I did an experiment in this paper http://dl.acm.org/citation.cfm?id=2647517&dl=ACM&coll=DL&CFI... where I showed that just be rearranging some code you can confuse the Rubinius object allocator into using a slow path for instance variables. That gives you both slow performance, and worse than that, unpredictable performance - the programmer doesn't understand what they've done wrong to trigger that fallback performance.
Consider how many people end up implement their own introspectable C object models.