Re: Do symbol references always go through a hash table?

From: Date: Wed, 18 May 2016 06:42:50 +0000
Subject: Re: Do symbol references always go through a hash table?
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-93392@lists.php.net to get a copy of this message
On Tue, May 17, 2016 at 9:10 PM, Jesse Schalken <me@jesseschalken.com> wrote: > On Wed, May 18, 2016 at 1:06 PM, Sara Golemon <pollita@php.net> wrote: >> >> Yes, but that doesn't mean you should micro-optimize around it. Just >> write code that's easy to maintain and trust the compiler to do the >> best job at making it not-slow. :) >> > > Do you happen to know whether or not HHVM does a better job in the case of a > function being called repeatedly with different implementations of a > class/interface? > Yes. In the case of HHVM, different types coming into a function generate different tracelets and each tracelet is able to burn its own target method into the native code. I say *able*, though. There are also translation paths which result in simply punting to a lookup at runtime. The decision making process the compiler goes through is... complex. > I don't optimised prematurely, but if I've got performance problems today > and getting a more sophisticated compiler/runtime isn't an option, and I > can't work around it by some other means then I don't really have a choice. > Saying for the list archive benefit as much as yours. It's only too easy for this to show up on StackOverflow with a recommendation to "always break oop conventions by wrapping method calls in a chain of if (instanceof) checks to cache the right method pointer, yadda yadda..." and the next thing you know it's php sadness all over again. -Sara

« previous php.internals (#93392) next »