Minor performance improvements

Поиск
Список
Период
Сортировка
От Stephen Denne
Тема Minor performance improvements
Дата
Msg-id F0238EBA67824444BC1CB4700960CB48024CDC7A@dmpeints002.isotach.com
обсуждение исходный текст
Ответы Re: Minor performance improvements  (Kris Jurka <books@ejurka.com>)
Список pgsql-jdbc

Four small optimizations in org.postgresql.core.PGStream:

1) The int to byte conversion is not needed in this method:

    public void SendChar(int val) throws IOException
    {
        pg_output.write((byte)val);
    }

(I found this while profiling a test that included about 5000 queries. This method was called half a million times, and actually had the third largest "own time" behind executeBatch and executeQuery)

2) The byte masks are not required in SendInteger4 and SendInteger2, as OutputStream.write(int) ignores the top 24 bits. Though if these are removed I think comments should be included instead to clarify that only the bottom eight bits get written.

3) The method with the signature: void Send(byte buf[], int off, int siz),
Could be rewritten so that the test occurs once instead of twice: (buf.length - off) < siz

4) two new parameterless methods should be added to optimize int ReceiveIntegerR(int siz) when called with size 2 and 4, as calls with these parameter values are very common. The call sites should change to use the new methods.

Stephen Denne
Java Developer
Corporate Development
Datamail Ltd
1 Victoria Street
Petone 5012
PO Box 31249
Lower Hutt 5040
Tel: +64 4 568 8200 extension 8638
Fax: +64 4 568 9600
Website: www.datamail.co.nz




At the Datamail Group we value team commitment, respect, achievement, customer focus, and courage.

This email with any attachments is confidential and may be subject to legal privilege. If it is not intended for you please advise by reply immediately, destroy it and do not copy, disclose or use it in any way.





This email has been scanned by the DMZGlobal Business Quality Electronic Messaging Suite.
Please see http://www.dmzglobal.com/services/bqem.htm for details.



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

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: Calling functions with table-based-type parametars
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: Minor performance improvements