4 ms·
> Ruby or Python for for having a very dynamic object model and method calling/message passing, witch results in non-optimisable call paths because they have to
by jashmatthews 6y ago
> Ruby or Python for for having a very dynamic object model and method calling/message passing, witch results in non-optimisable call paths because they have to be resolved every single time.
The Ruby implementations don't really do that. They use "inline caches" so this lookup normally only happens once per call-site.
- monocasa 6y agoIf there's only one backing type being looked up. If there's more than one, the inline cache thrashs like they're saying.
- jashmatthews 6y agoJRuby has had polymorphic inline caches for like a decade and CRuby will actually cache multiple types in the method cache as long as they cache the same method since https://github.com/ruby/ruby/pull/2583 https://github.com/ruby/ruby/pull/2583
- monocasa 6y agoJRuby is JVM and not really what I'm talking about. And still on CRuby if you have any dynacism, you thrash your cache.