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 1lIbMs-0007IH-Ny for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Mar 2021 18:09:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lIbMr-0008Gh-My for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Mar 2021 18:09:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lIbMr-0008Ga-94 for pgsql-hackers@lists.postgresql.org; Sat, 06 Mar 2021 18:09:33 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lIbMo-00050i-Of for pgsql-hackers@lists.postgresql.org; Sat, 06 Mar 2021 18:09:32 +0000 Received: by mail-pj1-x102f.google.com with SMTP id jx13so943592pjb.1 for ; Sat, 06 Mar 2021 10:09:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mQUNCJMUmqwkWZ6XgfmHVx7f810UGu2+6j9LrpKSC/Q=; b=Ic6O5y/9KSuLt9EBYaUSNSeIttuZmLzI2x0KRTOSok43qsithXkPcCz5UiY4rP1NAi ZNU94aDoEEWyxrNgub2AWhAkqkxlBB2AIjwxAuak8dTv9SiXM4BZyCeCCvLm10IM3sni /1jCqx0fzkGveOPdgxwYj2yd2Fn9sPccfMu/A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mQUNCJMUmqwkWZ6XgfmHVx7f810UGu2+6j9LrpKSC/Q=; b=Yxat6em1d4nXpgrGI4TxGDC4R1ixcl6crP7Ebh6YDPJhTl8B+Q8dEucQ7WoPsbx4tw g+KvPqBBqpO7V++Pqz3s/9Mij6EKxvdl+CtuJKUCMSbY5EdVr1uiFfTVb5A1H4KM5eCS msziU9Lueclm9NC6W7TsEwLr3O6lSYrodi9oXehQziSiHEAopiEIJDTEe4xg1I4xLnU7 COOEFqsxNFUzUAKBt4vLuSo+tFrKgpCPGcRbcOBXTRNZDxmGlbqAjnUDpBFW8TkzfS/x 8x137NjsnLX1LgOWV2KPCivpcCZu4iWzCIFRv+nGmENUD2uZ3QgypSEeWL+4pPA90wS7 JkWA== X-Gm-Message-State: AOAM531GLXqCDtXLOWXwVbxDFAW+leBSyzsQ59r7weg2TU4SAOxsuELg 1naGaAzLwyG9lFjhiMfoIrMy1Q== X-Google-Smtp-Source: ABdhPJyA7pnQOSZ5HGT0iAD4ZXmaQvszeKWWdO0bSgBBZV8GmlCO/c4ku7QOzk3fxWvNfaT2c7NF1Q== X-Received: by 2002:a17:902:aa4b:b029:e2:bb4b:a63 with SMTP id c11-20020a170902aa4bb02900e2bb4b0a63mr13866170plr.7.1615054168295; Sat, 06 Mar 2021 10:09:28 -0800 (PST) Received: from rfd.leadboat.com ([2600:1702:a20:5750::46]) by smtp.gmail.com with ESMTPSA id z22sm5950102pfa.41.2021.03.06.10.09.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 Mar 2021 10:09:27 -0800 (PST) Date: Sat, 6 Mar 2021 10:09:25 -0800 From: Noah Misch To: Joel Jacobson Cc: Tom Lane , pgsql-hackers@lists.postgresql.org Subject: Re: Some regular-expression performance hacking Message-ID: <20210306180925.GA2345664@rfd.leadboat.com> References: <1340281.1613018383@sss.pgh.pa.us> <85140bfb-516c-449b-8a03-7930abb42b88@www.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <85140bfb-516c-449b-8a03-7930abb42b88@www.fastmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Feb 13, 2021 at 06:19:34PM +0100, Joel Jacobson wrote: > To test the correctness of the patches, > I thought it would be nice with some real-life regexes, > and just as important, some real-life text strings, > to which the real-life regexes are applied to. > > I therefore patched Chromium's v8 regexes engine, > to log the actual regexes that get compiled when > visiting websites, and also the text strings that > are the regexes are applied to during run-time > when the regexes are executed. > > I logged the regex and text strings as base64 encoded > strings to STDOUT, to make it easy to grep out the data, > so it could be imported into PostgreSQL for analytics. > > In total, I scraped the first-page of some ~50k websites, > which produced 45M test rows to import, > which when GROUP BY pattern and flags was reduced > down to 235k different regex patterns, > and 1.5M different text string subjects. It's great to see this kind of testing. Thanks for doing it.