pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vadim Nasardinov <vadimn@redhat.com>
To: pgsql-jdbc@postgresql.org
Subject: "multianewarray" vs. "anewarray" (was: Re: Performance tweaks)
Date: Tue, 22 Feb 2005 16:57:04 -0500
Message-ID: <200502221657.04252@vadim.nasardinov> (raw)
In-Reply-To: <421BA48A.4010601@opencloud.com>
References: <421B0740.3050104@speakeasy.net>
	<421BA48A.4010601@opencloud.com>

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."<init>":()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."<init>":()V
 |    4: aload_0
 |    5: bipush 42
 |    7: anewarray #2; //class "[B"
 |    10: putfield #3; //Field answer:[[B
 |    13: return
 | 
 | }



Message-ID: <200502221657.04252@vadim.nasardinov>
Permalink:  ../200502221657.04252@vadim.nasardinov/
Also on:    postgresql.org/message-id/200502221657.04252@vadim.nasardinov

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: vadimn@redhat.com
  Subject: Re: "multianewarray" vs. "anewarray" (was: Re: Performance tweaks)
  In-Reply-To: <200502221657.04252@vadim.nasardinov>
  References: <421B0740.3050104@speakeasy.net> <421BA48A.4010601@opencloud.com> <200502221657.04252@vadim.nasardinov>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox