Akim Demaille
Le 9 oct. 2014 à 22:20, Joaquin M Lopez Munoz
a écrit :
Why do you want to have a factory per node type?
To be able to try it and to bench it. I'd like to be sure about the choice to make wrt the overhaul of my ASTs, and the options I have so far seem to be:
a. a single factory based on Flyweight, and use derived_poly_flyweight
b. one factory made by hand on top of map or unordered_map
c. likewise, but with Flyweight and key_value
As for c, you can have something more or less along that line by using your latest attempt (http://coliru.stacked-crooked.com/a/2b768fa26574adea ), declaring the flyweights with the no_tracking policy and having them store a weak_ptr (which boild down to your b hand-made scenario.)
Hash containers' performance is basically independent of the number of elements being contained [...]
Well, this is not so clear to me, as the expressions I store have often a strong regularity, with many elements of the same kind in a row.
Of course, benchmarking is the best way to go. I'd be interested in knowing your outcomes. Joaquín M López Muñoz Telefónica