]> Cypherpunks repositories - gostls13.git/commit
regexp/syntax: append patchLists in constant time
authorAndy Balholm <andy@balholm.com>
Mon, 15 Jun 2020 22:54:49 +0000 (15:54 -0700)
committerIan Lance Taylor <iant@golang.org>
Thu, 18 Jun 2020 00:40:11 +0000 (00:40 +0000)
commit0ce1ffc49d3935a41e1fff2aec224c254a9fad1d
tree2abff935d21f788f5483a1e4e2bd2c5114bbf8a5
parent8b98498a5833111402a2fe8f13a6605e071994b6
regexp/syntax: append patchLists in constant time

By keeping a tail pointer, we can append to a patchList in constant
time, rather than in time proportional to the length of the list. This
gets rid of the quadratic compile times we were seeing for long series
of alternations.

This is basically the same change as
https://github.com/google/re2/commit/e9d517989f66f2e0a24cde42f4d2424dd3e4a9b9.

Fixes #39542.

Change-Id: Ib4ca0ca9c55abd1594df1984653c7d311ccf7572
Reviewed-on: https://go-review.googlesource.com/c/go/+/238079
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/regexp/syntax/compile.go