From 3ed02c34e63411a1ef6d2f71d37b9ebd787b99c0 Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Thu, 31 Aug 2023 15:45:11 +0200 Subject: [PATCH] RakuAST: reuse expectations list instead of creating a new one every time. Should help a bit in memory churn. --- src/Raku/Grammar.nqp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Raku/Grammar.nqp b/src/Raku/Grammar.nqp index be4f8e50c97..2758a5cca23 100644 --- a/src/Raku/Grammar.nqp +++ b/src/Raku/Grammar.nqp @@ -20,6 +20,9 @@ my role stop[$stop] { token stopper { $stop } } +#------------------------------------------------------------------------------- +# Functionality common to all Raku grammars + role Raku::Common { #------------------------------------------------------------------------------- @@ -68,7 +71,7 @@ role Raku::Common { # Reset expectations method reset-expectations() { - self.'!set_highexpect'(nqp::list_s) + nqp::setelems(self.'!highexpect'(),0) } #-------------------------------------------------------------------------------