
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/03/2010 08:28 AM, Stewart, Robert wrote:
But, you save the cost of copying a large object. COW has many disadvantages, but how can you claim it is slower when you require a copy?
Did you miss the "but then need to modify it/them" part? The only reason for the copy was to have a mutable copy. Thus, the COW overhead was useless in that example.
Not exactly useless -- I *do* know enough to avoid things that are completely useless. :-) The purpose was to initialize them to the value of another integer, such as a parameter, before going into a loop that modifies them based on their current values. With copy-on-write, the initial allocation can be skipped, which (depending on the number of times it needs to loop) can be a significant savings. - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkve9jIACgkQp9x9jeZ9/wTgagCg4CyNXBelDY6JL/Uxq3x3FV0/ WekAoL+wDKQ3MUlZU55WyWDLuaYAoNV2 =q/F+ -----END PGP SIGNATURE-----