| From: | Oliver Jowett <oliver(at)opencloud(dot)com> |
|---|---|
| To: | Ken Geis <kgeis(at)speakeasy(dot)net> |
| Cc: | pgsql-jdbc(at)postgresql(dot)org |
| Subject: | Re: Performance tweaks |
| Date: | 2005-02-22 21:50:08 |
| Message-ID: | 421BA910.9050706@opencloud.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-jdbc |
Oliver Jowett wrote:
> Ken Geis 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?
Hmm, after some experimentation, they do produce different bytecode
(multianewarray vs. anewarray):
public void testit() {
byte[][] dummy = new byte[10][0];
byte[][] dummy2 = new byte[10][];
}
public void testit();
Code:
0: bipush 10
2: iconst_0
3: multianewarray #2, 2; //class "[[B"
7: astore_1
8: bipush 10
10: anewarray #3; //class "[B"
13: astore_2
14: return
Interesting to know it makes a performance difference. What JVM did you
test on?
-O
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Vadim Nasardinov | 2005-02-22 21:57:04 | "multianewarray" vs. "anewarray" (was: Re: Performance tweaks) |
| Previous Message | Alan Stange | 2005-02-22 21:48:57 | Re: Performance tweaks |