Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 0217CB5D90E for ; Wed, 22 Jun 2011 11:22:26 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 52139-06 for ; Wed, 22 Jun 2011 14:22:19 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.lat-lon.de (mail.lat-lon.de [178.63.90.186]) by mail.postgresql.org (Postfix) with ESMTP id 43EFCB5D8BD for ; Wed, 22 Jun 2011 11:22:19 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.lat-lon.de (Postfix) with ESMTP id 2C878198003; Wed, 22 Jun 2011 16:22:19 +0200 (CEST) X-Virus-Scanned: by amavisd-new at lat-lon.de Received: from mail.lat-lon.de ([127.0.0.1]) by localhost (mail.lat-lon.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YcB+dPNAC-wY; Wed, 22 Jun 2011 16:22:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.lat-lon.de (Postfix) with ESMTP id 86AFB198005; Wed, 22 Jun 2011 16:22:10 +0200 (CEST) Received: from localhost (unknown [217.203.68.35]) (Authenticated sender: schmitz@lat-lon.de) by mail.lat-lon.de (Postfix) with ESMTP id 71342198003; Wed, 22 Jun 2011 16:22:09 +0200 (CEST) Date: Wed, 22 Jun 2011 16:22:06 +0200 From: Andreas Schmitz To: Oliver Jowett Cc: Craig Ringer , pgsql-jdbc@postgresql.org Subject: Re: bytea performance tweak Message-ID: <20110622142205.GB2652@summalogicae.occamlabs.local> References: <20110621130713.GB3919@summalogicae.occamlabs.local> <4E016112.3080709@postnewspapers.com.au> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="A6N2fC+uXW/VQSAv" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201106/52 X-Sequence-Number: 21976 --A6N2fC+uXW/VQSAv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Oliver Jowett wrote: Hi, > On 22 June 2011 16:24, Oliver Jowett wrote: >=20 > > 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. >=20 > 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%). >=20 > $ java -server -version; uname -a; time java -server -classpath . Benchma= rk 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 >=20 > real 1m55.117s > user 1m55.400s > sys 0m0.210s >=20 > (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) >=20 > 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 --A6N2fC+uXW/VQSAv Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAk4B+o0ACgkQ737OVr+Ru7rbogCgnNtJKIULXOhVyXjSCMxH5BDt w4kAoNs2Jc91qmov4prU+sHcNxnDv0fT =dlJE -----END PGP SIGNATURE----- --A6N2fC+uXW/VQSAv--