Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kSkF5-0007hf-Da for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Oct 2020 17:07:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kSkF4-0004GG-AN for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Oct 2020 17:07:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kSkEg-0001Pl-FT for pgsql-hackers@lists.postgresql.org; Wed, 14 Oct 2020 17:06:46 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kSkEc-0007vl-0j for pgsql-hackers@postgresql.org; Wed, 14 Oct 2020 17:06:45 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 09EH6eKx3619433; Wed, 14 Oct 2020 13:06:40 -0400 From: Tom Lane To: John Naylor cc: pgsql-hackers Subject: Re: speed up unicode decomposition and recomposition In-reply-to: References: Comments: In-reply-to John Naylor message dated "Wed, 14 Oct 2020 12:58:21 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3619431.1602695200.1@sss.pgh.pa.us> Date: Wed, 14 Oct 2020 13:06:40 -0400 Message-ID: <3619432.1602695200@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk John Naylor writes: > Some other considerations: > - As I alluded above, this adds ~26kB to libpq because of SASLPrep. Since > the decomp array was reordered to optimize linear search, it can no longer > be used for binary search. It's possible to build two arrays, one for > frontend and one for backend, but that's additional complexity. We could > also force frontend to do a linear search all the time, but that seems > foolish. I haven't checked if it's possible to exclude the hash from > backend's libpq. IIUC, the only place libpq uses this is to process a password-sized string or two during connection establishment. It seems quite silly to add 26kB in order to make that faster. Seems like a nice speedup on the backend side, but I'd vote for keeping the frontend as-is. regards, tom lane