X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8C8C39DCB73 for ; Fri, 20 Jan 2006 17:38:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80760-06 for ; Fri, 20 Jan 2006 17:37:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svana.org (svana.org [125.62.94.225]) by postgresql.org (Postfix) with ESMTP id EABF89DCA82 for ; Fri, 20 Jan 2006 17:37:55 -0400 (AST) Received: from kleptog by svana.org with local (Exim 4.50) id 1F03xC-00018v-It; Sat, 21 Jan 2006 08:37:54 +1100 Date: Fri, 20 Jan 2006 22:37:54 +0100 From: Martijn van Oosterhout To: Tom Lane Cc: Stephan Vollmer , pgsql-performance@postgreSQL.org Subject: Re: [GENERAL] Creation of tsearch2 index is very slow Message-ID: <20060120213754.GG31908@svana.org> Reply-To: Martijn van Oosterhout References: <43D0ED57.1020608@gmx.de> <17454.1137771321@sss.pgh.pa.us> <20060120170452.GC31908@svana.org> <26153.1137784469@sss.pgh.pa.us> <20060120201036.GE31908@svana.org> <26583.1137788505@sss.pgh.pa.us> <20060120205132.GF31908@svana.org> <26958.1137791955@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="iBwuxWUsK/REspAd" Content-Disposition: inline In-Reply-To: <26958.1137791955@sss.pgh.pa.us> X-PGP-Key-ID: Length=1024; ID=0x0DC67BE6 X-PGP-Key-Fingerprint: 295F A899 A81A 156D B522 48A7 6394 F08A 0DC6 7BE6 X-PGP-Key-URL: User-Agent: Mutt/1.5.9i X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: kleptog@svana.org X-SA-Exim-Scanned: No (on svana.org); SAEximRunCond expanded to false X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.129 required=5 tests=[AWL=0.129] X-Spam-Score: 0.129 X-Spam-Level: X-Archive-Number: 200601/364 X-Sequence-Number: 16842 --iBwuxWUsK/REspAd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 20, 2006 at 04:19:15PM -0500, Tom Lane wrote: > % cumulative self self total =20 > time seconds seconds calls Ks/call Ks/call name =20 > 98.96 1495.93 1495.93 33035195 0.00 0.00 hemdistsign > So we gotta fix hemdistsign ... lol! Yeah, I guess so. Pretty nasty loop. LOOPBIT will iterate 8*63=3D504 times and it's going to do silly bit handling on each and every iteration. Given that all it's doing is counting bits, a simple fix would be to loop over bytes, use XOR and count ones. For extreme speedup create a lookup table with 256 entries to give you the answer straight away... Have a nice day, --=20 Martijn van Oosterhout http://svana.org/kleptog/ > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a > tool for doing 5% of the work and then sitting around waiting for someone > else to do the other 95% so you can sue them. --iBwuxWUsK/REspAd Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFD0VgyIB7bNG8LQkwRAub5AJ40vYiLjdDd0GIoev7PzdZccAEiHwCfeRqV nO8oYeaYYc4VINZGiZRYkOk= =goOw -----END PGP SIGNATURE----- --iBwuxWUsK/REspAd--