Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 19171 invoked from network); 18 Dec 2008 13:31:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Dec 2008 13:31:10 -0000 Received: (qmail 98605 invoked by uid 500); 18 Dec 2008 13:31:21 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 98581 invoked by uid 500); 18 Dec 2008 13:31:21 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 98570 invoked by uid 99); 18 Dec 2008 13:31:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Dec 2008 05:31:21 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of alexey.v.varlamov@gmail.com designates 209.85.198.242 as permitted sender) Received: from [209.85.198.242] (HELO rv-out-0708.google.com) (209.85.198.242) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Dec 2008 13:31:01 +0000 Received: by rv-out-0708.google.com with SMTP id k29so537053rvb.0 for ; Thu, 18 Dec 2008 05:30:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=LYZjAW8IkxUTj5ByasZAJV7LzUYx49OiNJSgoGH1Ly8=; b=mEW5t4uhtCQl4HDcCuwOlHJ5gES/a2r7pEx8K/hWTQN1qyNdvKZFSrP7Cc24PBCmIm uIjywKt0+4goEoVr0xKera7cVxfAd+78REEK6CJsuXIDmRjSkCVJO2+jbQn4HBri80Ye 7yYPUaWcCs+SyoOz2Jateb0AekXHlz3WbW7Ss= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=gWZYrljXgSau/z+sG2FufWv0qCty5un7KkY0HJ2omQ4X5lUB58D3PAXuApvRLeHVR/ B3fyz3xrALCCi81Aly/60kevT68i5YEI3EgQI++9qSI4W8Ye0V8pmxZhy6aKIM0QEDXB IfG2WeJK9GkEgj352vxENQBRQc0k7PA0HJTYE= Received: by 10.141.96.19 with SMTP id y19mr999049rvl.89.1229607039837; Thu, 18 Dec 2008 05:30:39 -0800 (PST) Received: by 10.140.43.1 with HTTP; Thu, 18 Dec 2008 05:30:39 -0800 (PST) Message-ID: Date: Thu, 18 Dec 2008 19:30:39 +0600 From: "Alexey Varlamov" To: dev@harmony.apache.org Subject: Re: [classlib]Make harmony's modularity better In-Reply-To: <211709bc0812172138y36ac05d4nb131c774abe41ba5@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <211709bc0812150226u2e49fa42u7acb999391d49fd4@mail.gmail.com> <4946C2B9.1040702@gmail.com> <211709bc0812160035hb336ab0j30ce8d58e8d136ce@mail.gmail.com> <49478319.5040302@gmail.com> <636fd28e0812160626t77ca2a46j39c6ab4c2ab9d3b7@mail.gmail.com> <636fd28e0812160656j231e3d4dp58f509e83ed84cbe@mail.gmail.com> <4948EFAF.3090408@gmail.com> <5e7fd1eb0812170555w511f912ek91ca6c686ef685ed@mail.gmail.com> <4949729F.2030508@gmail.com> <211709bc0812172138y36ac05d4nb131c774abe41ba5@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org > > What we need is a performant version of something like ... > > boolean instanceOf(Object obj, String typeName) > > No more ideas, seem we have to chose between these, > 1. try/catch > 2. reflection > > The former has more overhead whereas the later has less compiler checking. AFAIU classloading is involved in both cases, moreover VM neccessarily records resolution results thus this should not be a performance issue. In general, reflection has not less overhead at least, and if we take into account that void catch clause is easily optimized by JIT, 1st solution is absolute winner. IMO no need to look for better solution here, numerous reflection calls around beans would absorb that small potential gain anyway. I bet no benchmark would show any boost even if we'd implement such instanceOf(Object obj, String typeName) via vmmagics. -- Alexey