From: Andreas Schmitz <schmitz@occamlabs.de>
To: Oliver Jowett <oliver@opencloud.com>
Cc: Craig Ringer <craig@postnewspapers.com.au>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: bytea performance tweak
Date: Wed, 22 Jun 2011 16:22:06 +0200
Message-ID: <20110622142205.GB2652@summalogicae.occamlabs.local> (raw)
In-Reply-To: <BANLkTincjfaot3pNo6Acj6aGbKS+gX+9dg@mail.gmail.com>
References: <20110621130713.GB3919@summalogicae.occamlabs.local>
<BANLkTimryw=Sm5q4v53PQNkdi+RjAfgJBA@mail.gmail.com>
<4E016112.3080709@postnewspapers.com.au>
<BANLkTik1W1j0Y0LQyJ0ZL1XYxo_TSST6=Q@mail.gmail.com>
<BANLkTincjfaot3pNo6Acj6aGbKS+gX+9dg@mail.gmail.com>
Oliver Jowett wrote:
Hi,
> On 22 June 2011 16:24, Oliver Jowett <oliver@opencloud.com> wrote:
>
> > I've seen enough weird performance behavior from the JIT in the past
> > to be inherently suspicious of anything that claims to be a speedup
> > without numbers to back it up.
> > If we have a benchmark to work from, then I'm sure there's even more
> > performance we can squeeze out of it.
>
> FWIW here's a quick microbenchmark.
> Andreas' patch is about 5x faster than the current code.
> A version using a one-dimensional lookup array is marginally faster again (7%).
>
> $ java -server -version; uname -a; time java -server -classpath . Benchmark 5
> java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
> Linux downpour 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:24 UTC
> 2011 x86_64 x86_64 x86_64 GNU/Linux
> original code, 1000 1161632 iterations in
> 5018679 us 4.32 us/iteration
> 2D array lookup, 1000 6025844 iterations in
> 4948308 us 0.82 us/iteration
> 1D array lookup, 1000 6361396 iterations in
> 4996605 us 0.79 us/iteration
> original code, 100000 9196 iterations in
> 5019373 us 545.82 us/iteration
> 2D array lookup, 100000 57049 iterations in
> 4999200 us 87.63 us/iteration
> 1D array lookup, 100000 61162 iterations in
> 5000197 us 81.75 us/iteration
>
> real 1m55.117s
> user 1m55.400s
> sys 0m0.210s
>
> (I also tried some variations with induction variables but got no real
> speedup and enough weird results to make me think it's confusing the
> JIT)
>
> There is also a bug in the original patch that I noticed along the way
> (the initialization of HEX_LOOKUP doesn't use lo2/hi2) - fixed in the
> benchmark code.
wow, I wouldn't have expected that much of a speedup. I've also tested
using a one dimensional array, but my crappy main method did not see
much of a difference. Thanks for benchmarking in detail!
Best regards, Andreas
Attachments:
signature.asc (application/pgp-signature, 197B) download
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: schmitz@occamlabs.de, oliver@opencloud.com, craig@postnewspapers.com.au
Subject: Re: bytea performance tweak
In-Reply-To: <20110622142205.GB2652@summalogicae.occamlabs.local>
References: <20110621130713.GB3919@summalogicae.occamlabs.local> <BANLkTimryw=Sm5q4v53PQNkdi+RjAfgJBA@mail.gmail.com> <4E016112.3080709@postnewspapers.com.au> <BANLkTik1W1j0Y0LQyJ0ZL1XYxo_TSST6=Q@mail.gmail.com> <BANLkTincjfaot3pNo6Acj6aGbKS+gX+9dg@mail.gmail.com> <20110622142205.GB2652@summalogicae.occamlabs.local>
* 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