Re: Minor performance improvements

From: "Stephen Denne" <Stephen(dot)Denne(at)datamail(dot)co(dot)nz>
To: "Kris Jurka" <books(at)ejurka(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Minor performance improvements
Date: 2007-02-27 05:29:34
Message-ID: F0238EBA67824444BC1CB4700960CB4802540211@dmpeints002.isotach.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

So it does.

I used

pg_output = new BufferedOutputStream(new OutputStream() {public void write(int b) throws IOException {}}, 8192);

And confirm that I get similar slowdown for my code, and much faster operation for your code.

The only thing I can think might be going on with your code is the hotspot compiler recognising the bytecode pattern in use, and using the fastest method it knows of filling that byte array.

SendInteger2 behaves the same surprising way.

Regards,
Stephen.

-----Original Message-----
From: Kris Jurka [mailto:books(at)ejurka(dot)com]
Sent: Tuesday, 27 February 2007 5:24 p.m.
To: Stephen Denne
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] Minor performance improvements

On Tue, 27 Feb 2007, Stephen Denne wrote:

> I'm sad to say that I have not created any micro-benchmark tests, and
> unfortunately the improvements are very minor, and far overshadowed by
> the variability I get from my system.
>

I've created the attached test which tests the original code (Orig), your code (Two), and my suggestion of an int4buf (Three) and got the following surprising results:

jurka(at)tony:~/pg/jdbc/projects/perf/micro$ java -classpath . Tester Orig | sort -n
11335
11370
11468
11484
11487
jurka(at)tony:~/pg/jdbc/projects/perf/micro$ java -classpath . Tester Two | sort -n
12472
12476
12489
12492
12619
jurka(at)tony:~/pg/jdbc/projects/perf/micro$ java -classpath . Tester Three | sort -n
4259
4562
4564
4611
4689

This shows your code is actually slower than the original code, although I have no idea why that could be. It shows the int4buf idea as a clear winner. I'm a little suspicious of the whole test because of your numbers going up. Could you take a look at this and possibly confirm the results?
I'm not sure if windows has an equivalent to /dev/null, but I wanted to avoid any impact of disk io.

Kris Jurka

Disclaimer:
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.
__________________________________________________________________

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2007-02-27 08:21:25 Re: Minor performance improvements
Previous Message Kris Jurka 2007-02-27 04:24:09 Re: Minor performance improvements