bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Less memory pressure on the "list" bench.


From: Akim Demaille
Subject: [PATCH] Less memory pressure on the "list" bench.
Date: Tue, 11 Nov 2008 14:23:16 -0000

        * etc/bench.pl.in (generate_grammar_list): Do not accumulate all
        the values, to limit memory pressure.
---
 ChangeLog       |    6 ++++++
 etc/bench.pl.in |   14 +++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b76264c..811d6fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2008-11-11  Akim Demaille  <address@hidden>
 
+       Less memory pressure on the "list" bench.
+       * etc/bench.pl.in (generate_grammar_list): Do not accumulate all
+       the values, to limit memory pressure.
+
+2008-11-11  Akim Demaille  <address@hidden>
+
        Introduce make_symbol.
        make_symbol provides a means to construct a full symbol (kind, value,
        location) in a single shot.  It is meant to be a Symbol constructor,
diff --git a/etc/bench.pl.in b/etc/bench.pl.in
index d058ce1..d365d65 100755
--- a/etc/bench.pl.in
+++ b/etc/bench.pl.in
@@ -634,12 +634,11 @@ result:
 
 text:
   /* nothing */                { /* This will generate an empty string */ }
-| text TEXT            { std::swap($$,$1); $$.append($2); }
+| text TEXT            { std::swap ($$, $2); }
 | text NUMBER          {
-                         std::swap($$,$1);
-                          std::ostringstream ss;
+                         std::ostringstream ss;
                          ss << ' ' << $2;
-                         $$.append(ss.str());
+                         $$ = ss.str();
                         }
 ;
 EOF
@@ -663,11 +662,12 @@ result:
 
 text:
   /* nothing */                { $$ = new std::string; }
-| text TEXT            { $$->append(*$2); delete $2; }
+| text TEXT            { delete $1; $$ = $2; }
 | text NUMBER          {
-                         std::ostringstream ss;
+                          delete $1;
+                          std::ostringstream ss;
                          ss << ' ' << $2;
-                         $$->append(ss.str());
+                         $$ = new std::string (ss.str());
                         }
 ;
 EOF
-- 
1.6.0.2.588.g3102





reply via email to

[Prev in Thread] Current Thread [Next in Thread]