|
Boost : |
Subject: Re: [boost] copy on write for std containers
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2010-12-04 19:58:27
Peter Foelsche wrote:
> "Jeffrey Lee Hellrung, Jr." <jhellrung_at_[hidden]> wrote in message
> news:4CFADA65.40708_at_ucla.edu...
>> I think the point is that copy-on-write is rarely optimal, often
>> suboptimal, and increases complexity; hence it should not be
>> encouraged.
>
>
> increases complexity -- wrong -- I only replaced the matching types
> -- the using code was not modified.
> The number of lines for the wrapper are minimal -- I only implemented
> the methods I'm using.
> I don't care about complexity the compiler has to manage.
> I care about the complexity I have to manage.
> I could introduce some filtering to avoid storing identical instances
> which would even more decrease the memory foot print.
No, no, no. Design an efficient algorithm with proper analysis of data flow that doesn't make any copies that aren't needed even when compiled in debug mode and your code will be simpler, more maintainable and faster. Why are you investing engineering effort into solving a problem that is entirely of your own making? Do by not doing. Don't dig holes just so that you can fill them in.
Regards,
Luke
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk