Re: Performance tweaks

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Performance tweaks
Дата
Msg-id 421BA910.9050706@opencloud.com
обсуждение исходный текст
Ответ на Re: Performance tweaks  (Oliver Jowett <oliver@opencloud.com>)
Список 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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Alan Stange
Дата:
Сообщение: Re: Performance tweaks
Следующее
От: Vadim Nasardinov
Дата:
Сообщение: "multianewarray" vs. "anewarray" (was: Re: Performance tweaks)