Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93392 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77963 invoked from network); 18 May 2016 06:42:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 May 2016 06:42:54 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.223.178 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.223.178 mail-io0-f178.google.com Received: from [209.85.223.178] ([209.85.223.178:36470] helo=mail-io0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0D/98-11000-DEE0C375 for ; Wed, 18 May 2016 02:42:54 -0400 Received: by mail-io0-f178.google.com with SMTP id i75so53203477ioa.3 for ; Tue, 17 May 2016 23:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golemon-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=8okrTJiQG/p74Mk8Od3TsFJE8ZjCRa9jUmc2yYANQrU=; b=knUIeJhe3MVjUZAGiO1OQ5ObOvcNx2QljPw9Vi988tSTIweHoKxxYVqTPSoEC/m7+Q zrq8mPyqackloLjlRWnB0tFwnAPf3fpwnP+77LXt22i10M4BNDbnxWXtOGNUCTsh7S+5 i+XKKXwvJf651xSfNDZPyV9gaV/dUp3qvR/NoCh9creSJJixO3356tGjOjfb2byfHyo3 fx79oLcR2/VXSdnHgcxo9AkCRXymcFMkgO6MfrXyGuoavf8N7cucJDp46DqNeqJjDRkd vCplgFnbwYOMWMhl0P+ovwoo8tPRJGT2nDPr88a14syWHh3nIAWpz/Zj8pz9mrdWBuBk WJIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=8okrTJiQG/p74Mk8Od3TsFJE8ZjCRa9jUmc2yYANQrU=; b=DQG+z1UVS5YOufM/4SZUrcjioCca0MSiiQtyNZ0iW/vBD4MDkWPcT21kQB4u8q9Fy9 bq1qpigpe1opQUwj3yDbM3lwXyxerfp/g15w/d/o9gIh4hdbqWq2w5TI3qF80JI53d/f T5U6eI7GVVFRplqABI4vEph+ZMULkz6V/XM0zXok01WQGH3HlxwVYU+L2A8F0SXG6JFv 4plA7UeCa+Xy/mFLw8I7QiNYdAFzrqwDPB1QXxzSfbbKFr6Tusw8DGgDmu+0rTnvqhNN Uc6X2izYotTA0nlpYXYxaFOsBsAUtlz4dUPHV9BdxBiQPShr0HBy8kpeBgA4hwpCvMX7 4LMQ== X-Gm-Message-State: AOPr4FW3RHOZp3N97Y5yZoZla8YsOx3UWMyN7DkhjZwsFEeSjb6yRIZ7kBr6DPsuDr9pjEISPLm+3VwE5vIkFA== MIME-Version: 1.0 X-Received: by 10.36.71.7 with SMTP id t7mr4100896itb.9.1463553770910; Tue, 17 May 2016 23:42:50 -0700 (PDT) Sender: php@golemon.com Received: by 10.36.9.67 with HTTP; Tue, 17 May 2016 23:42:50 -0700 (PDT) X-Originating-IP: [107.198.91.68] In-Reply-To: References: Date: Tue, 17 May 2016 23:42:50 -0700 X-Google-Sender-Auth: J1NZNoyQ0TdKfVaAspt9U8HHIbs Message-ID: To: Jesse Schalken Cc: Nikita Popov , PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Do symbol references always go through a hash table? From: pollita@php.net (Sara Golemon) On Tue, May 17, 2016 at 9:10 PM, Jesse Schalken wrote: > On Wed, May 18, 2016 at 1:06 PM, Sara Golemon 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