parser: `build_reduce_table` uses a sequence of add instead of a `.with_items`
authorJean Privat <jean@pryen.org>
Thu, 11 Jun 2015 19:43:33 +0000 (15:43 -0400)
committerJean Privat <jean@pryen.org>
Thu, 11 Jun 2015 19:43:33 +0000 (15:43 -0400)
The big vararg generated produce C code that takes 30m to compile with
clang-3.6 because of a regression (the same code takes less than 1s with
clang-3.5).

Unfortunately, clang-3.6 is currently provided by Apple to MacOS X users.

Signed-off-by: Jean Privat <jean@pryen.org>

src/parser/xss/parser.xss

index fb8b79f..8e38001 100644 (file)
@@ -20,11 +20,11 @@ $ template make_parser()
 redef class Parser
        redef fun build_reduce_table
        do
-               _reduce_table = new Array[ReduceAction].with_items(
+               var reduce_table = new Array[ReduceAction].with_capacity(${count(rules/rule)})
+               self.reduce_table = reduce_table
 $ foreach {rules/rule}
-                       new ReduceAction@index(@leftside)[-sep ','-]
+               reduce_table.add new ReduceAction@index(@leftside)
 $ end foreach
-               )
        end
 end