From a413cad41e32cf2235a5ec4fbc1eb3fdcc0607dd Mon Sep 17 00:00:00 2001 From: Alexander Nikolov Date: Sun, 20 Nov 2022 00:27:26 +0200 Subject: [PATCH] Replaced SSGROW with SSCHECK inside regcppush Observed is huge slow-down on Win32 machines with many leveled nested recursive patterns. Bottleneck identified to be SSGROW reallocations inside regcppush. Replacing with SSCHECK yields huge performance gains (to the extened for it to be called a "fix") on said platform. --- regexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regexec.c b/regexec.c index 1d34e99a7efa..3ee9e4092e38 100644 --- a/regexec.c +++ b/regexec.c @@ -261,7 +261,7 @@ S_regcppush(pTHX_ const regexp *rex, I32 parenfloor, U32 maxopenparen _pDEPTH) ); ); - SSGROW(total_elems + REGCP_FRAME_ELEMS); + SSCHECK(total_elems + REGCP_FRAME_ELEMS); /* memcpy the offs inside the stack - it's faster than for loop */ memcpy(&PL_savestack[PL_savestack_ix], rex->offs + parenfloor + 1, paren_bytes_to_push);