
on 03.05.2010 at 20:39 Stewart, Robert wrote :
DE wrote:
Stewart, Robert wrote :
DE wrote:
i believe that mutating operations are so expensive that the cow overhead becomes negligible and one can live with it unless he is very pedantic
Once again, allow me to point out that the copy was being made in order to mutate the copy. The COW operations are superfluous in that case.
i understand this point but i see no conflict between those two statements
There is no conflict other than that your response was directed to my statement that the COW overhead was superfluous in the context I addressed. Thus, using COW to satisfy the stated example pessimized the code.
it does indeed but the pessimization is negligible compared to the cost of an operation itself i suddenly have remebered a rule on optimization: measure, then optimize in other words: find a bottleneck and only then optimize the code causing it in this thread things look the other way around you guys make a guess and ask to change/optimize the code using that guess as the basis sorry, i consider it wrong in fact it must be like this: - i use it in a <usecase>, i profiled it and found a bottleneck in the following piece of code... otherwise there is a big chance we are wasting each others time making guesses and arguing about implementation details because optimizations born from that may be worthless -- Pavel P.S. if you notice a grammar mistake or weird phrasing in my message please point it out