Boost logo

Boost Users :

Subject: Re: [Boost-users] Flyweight: wrapping shared_ptr
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2014-10-10 08:00:59


Akim Demaille <akim <at> lrde.epita.fr> writes:

>
> Le 9 oct. 2014 à 22:20, Joaquin M Lopez Munoz <joaquin <at> tid.es> 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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net