Le 21/02/2015 23:24, Johan Fabry a écrit :
So the easy solution in ‘production use’ would be to create the parser once and then keep hanging on to it? I would not say that this is really a PetitParser issue, but more how the parser is used.
All other Smalltalk parsers are instantiated as many times as the PetitParser one in this benchmark, and their instanciation time is around 0 ms.
But, yes, I would think that one of the solution would be a pre-instantiation of a PetitParser, and a final instantiation to create an instance.
In a way, one could imagine writing SmaCC parsers in the same way that PetitParser parsers are written... pre-instantiation being the part where SmaCC generates and compile its parsers.
In this benchmark, this would cut parsing time by 2.
Thierry