From a0fd0d5a9077947d09777cf7631ca721ffabf9ec Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Tue, 4 May 2021 17:45:24 +0900 Subject: Improve performance of the symbolPositionSet When using a map to represent a set, performance degrades due to the increased number of calls of runtime.mapassign. Especially when the number of symbols is large, as in compiling a pattern that contains character properties like \p{Letter}, adding elements to the set alone may take several tens of seconds of CPU time. Therefore, this commit solves this problem by changing the representation of the set from map to array. --- compiler/ast_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'compiler/ast_test.go') diff --git a/compiler/ast_test.go b/compiler/ast_test.go index 8b0a0ee..2a77dfc 100644 --- a/compiler/ast_test.go +++ b/compiler/ast_test.go @@ -82,8 +82,8 @@ func TestASTNode(t *testing.T) { tests := []struct { root astNode nullable bool - first symbolPositionSet - last symbolPositionSet + first *symbolPositionSet + last *symbolPositionSet }{ { root: newSymbolNodeWithPos(0, 1), -- cgit v1.2.3