X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BDE1A8B9B90 for ; Tue, 22 Feb 2005 21:56:13 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27854-03 for ; Tue, 22 Feb 2005 21:56:03 +0000 (GMT) Received: from mx1.redhat.com (mx1.redhat.com [66.187.233.31]) by svr1.postgresql.org (Postfix) with ESMTP id DA0A08B9B5E for ; Tue, 22 Feb 2005 21:56:03 +0000 (GMT) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j1MLu3Wm009525 for ; Tue, 22 Feb 2005 16:56:03 -0500 Received: from mail.boston.redhat.com (mail.boston.redhat.com [172.16.76.12]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j1MLu3K28143 for ; Tue, 22 Feb 2005 16:56:03 -0500 Received: from vpn83-140.boston.redhat.com (vpn83-140.boston.redhat.com [172.16.83.140]) by mail.boston.redhat.com (8.12.8/8.12.8) with ESMTP id j1MLu2wO011786 for ; Tue, 22 Feb 2005 16:56:02 -0500 From: Vadim Nasardinov Organization: Red Hat / Westford To: pgsql-jdbc@postgresql.org Subject: "multianewarray" vs. "anewarray" (was: Re: Performance tweaks) Date: Tue, 22 Feb 2005 16:57:04 -0500 User-Agent: KMail/1.7.1 References: <421B0740.3050104@speakeasy.net> <421BA48A.4010601@opencloud.com> In-Reply-To: <421BA48A.4010601@opencloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200502221657.04252@vadim.nasardinov> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.018 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/163 X-Sequence-Number: 12343 On Tuesday 22 February 2005 16:30, Oliver Jowett wrote: > > I changed the line > > > > byte[][] answer = new byte[l_nf][0]; > > to > > byte[][] answer = new byte[l_nf][]; > > > > This gave ~1% increase on the benchmark I was running. > > Gah?! What JVM? Aren't the two forms equivalent? javap says it's "multianewarray" vs. "anewarray": | $ cat Test1.java | public class Test1 { | byte[][] answer = new byte[42][0]; | } | | $ cat Test2.java | public class Test2 { | byte[][] answer = new byte[42][]; | } | | $ javap -c -classpath . Test1 | Compiled from "Test1.java" | public class Test1 extends java.lang.Object{ | byte[][] answer; | | public Test1(); | Code: | 0: aload_0 | 1: invokespecial #1; //Method java/lang/Object."":()V | 4: aload_0 | 5: bipush 42 | 7: iconst_0 | 8: multianewarray #2, 2; //class "[[B" | 12: putfield #3; //Field answer:[[B | 15: return | | } | | $ javap -c -classpath . Test2 | Compiled from "Test2.java" | public class Test2 extends java.lang.Object{ | byte[][] answer; | | public Test2(); | Code: | 0: aload_0 | 1: invokespecial #1; //Method java/lang/Object."":()V | 4: aload_0 | 5: bipush 42 | 7: anewarray #2; //class "[B" | 10: putfield #3; //Field answer:[[B | 13: return | | }