Return-Path: Delivered-To: apmail-incubator-lucy-dev-archive@www.apache.org Received: (qmail 17479 invoked from network); 7 Mar 2011 08:18:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Mar 2011 08:18:29 -0000 Received: (qmail 71668 invoked by uid 500); 7 Mar 2011 08:18:29 -0000 Delivered-To: apmail-incubator-lucy-dev-archive@incubator.apache.org Received: (qmail 71597 invoked by uid 500); 7 Mar 2011 08:18:29 -0000 Mailing-List: contact lucy-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucy-dev@incubator.apache.org Delivered-To: mailing list lucy-dev@incubator.apache.org Received: (qmail 71587 invoked by uid 99); 7 Mar 2011 08:18:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Mar 2011 08:18:28 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [74.125.82.175] (HELO mail-wy0-f175.google.com) (74.125.82.175) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Mar 2011 08:18:23 +0000 Received: by wyb38 with SMTP id 38so3778562wyb.6 for ; Mon, 07 Mar 2011 00:18:02 -0800 (PST) Received: by 10.216.50.72 with SMTP id y50mr2173404web.28.1299485882081; Mon, 07 Mar 2011 00:18:02 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.85.139 with HTTP; Mon, 7 Mar 2011 00:17:42 -0800 (PST) In-Reply-To: <20110307050300.GB23513@rectangular.com> References: <20110303030834.GB5339@rectangular.com> <20110303063001.GA5707@rectangular.com> <20110307050300.GB23513@rectangular.com> From: Nathan Kurz Date: Mon, 7 Mar 2011 00:17:42 -0800 Message-ID: To: lucy-dev@incubator.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Subject: Re: [lucy-dev] Host overriding of all non-final methods On Sun, Mar 6, 2011 at 9:03 PM, Marvin Humphrey wr= ote: > On Fri, Mar 04, 2011 at 11:27:59PM -0800, Nathan Kurz wrote: >> On Wed, Mar 2, 2011 at 10:30 PM, Marvin Humphrey wrote: >> > Arguably, we don't even need the "final" keyword. =C2=A0We'd should be= nchmark to >> > confirm my recollection about the performance implications, but I'll b= et we >> > could remove it with no immediate impact on Lucy. >> >> I'd suggest this as the cleanest solution. =C2=A0Intuitively, I'd think >> that the benefit of 'final' would be very small, such that if one >> really cares about performance one should inline the function call >> completely and not worry about saving a single dereference. > > Sounds good -- I'll work up a patch. =C2=A0We'll leave the "inline" keywo= rd in > Clownfish, but drop the "final" keyword. Great. I think you could get away with dropping 'inline' as well. My point was not that Clownfish needs to inline things, but that if you really want to squeeze out the last drop of performance by avoiding function calls, you'll have to take control of the compilation yourself, likely by rewriting the entire core class in some unreadable and unmodifiable fashion. It would be interesting, though, to someday benchmark the potential advantage here. Once you're generating code, it wouldn't be hard to test generate a monolithic 'final' library as well, with inter-class inlining. But if one was to take this route for anything production, I think it would make more sense as an overall compile time option rather than a method-by-method keyword: -O lock-it-all-down. > Looking forward, we'll need to think about how to design our classes and > interfaces so that time-critical functionality can been inlined whenever > possible. While there is some small gain to be had here, I don't think it should be a priority. I can be as cycle-count-conscious as anyone, but once you're memory bound there isn't that much advantage is optimizing cycles much further. I think we can get far by keeping the base architecture fast (as it currently is) and concentrating on data layout. To the extent that one does worry about cycles, it's not the function calls that need to be avoided, rather the mispredicted branches. So long as you take the same convoluted path every time, modern processors are monstrously efficient. Let's make the Northbridge scream for mercy. Nathan Kurz nate@verse.com