|
Boost Users : |
Subject: Re: [Boost-users] Flyweight: wrapping shared_ptr
From: Akim Demaille (akim_at_[hidden])
Date: 2014-10-22 11:33:38
Le 22 oct. 2014 à 16:24, Joaquin M Lopez Munoz <joaquin_at_[hidden]> a écrit :
> Akim Demaille <akim <at> lrde.epita.fr> writes:
>
>>
>> Hi Joaquin!
>>
>> Le 14 oct. 2014 à 11:34, Joaquin M Lopez Munoz <joaquin <at> tid.es> a
>> écrit :
>>>
>>> Hashing and equality comparison of flyweight'd expressions is going
>>> to be blazingly fast as compared with recursive non-flyweight'd
>>> versions.
>>
>> Yes, that's where I expect to get most of my speed up. However,
>> for deep expressions, ordered containers were quite fast, more
>> than hashes, since often the comparison does not go deep inside.
>> So I'll have to bench whether to stick to ordered containers, or
>> move to unordered ones.
>
> I'm not sure I'm following you here... Comparison and hashing of flyweights
> is blazingly fast *and* does not depend on the expression depth of
> the flyweight'd values --it does not depend on the values at all, in fact.
Yes, of course. I was referring (with the "were", I agree it's subtle :)
to the pre-Flyweight implementation. I was commenting that I was surprised
that in general ordered structures were faster that unordered ones, and
I suspect it's mostly because hashing is always deep, and comparison
is not.
However, I don't like Flyweight address comparison. Sure, it's fast.
It also not well defined, not repeatable, not portable etc. At least
when developing, I like having something more stable, so I will probably
stick with a deep comparison.
So I was saying that moving to flyweights also means, in my case,
looking for places where unordered is ok, and move to unordered in
these places.
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