
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/03/2010 07:39 AM, Stewart, Robert wrote:
If I read your example correctly, then that's about what I was thinking of: algorithms that have to start with a copy of one or more of the passed-in parameters, but then need to modify it/them. The division algorithm requires this, just as one example off the top of my head.
If your algorithm requires a copy, then COW should make it slower because it will first manipulate the reference count and because you must query in each mutating operation whether to make a unique copy.
That depends on how expensive a deep-copy operation is. Making a deep copy of an xint::integer can be a very expensive proposition, compared to just manipulating some pointers, enough to more than offset the overhead of the reference counting stuff. Deep-copying a 2048-bit integer, for example, requires copying something like 76 bytes (the exact number will vary by platform), as well as an allocation. And 2048-bit integers are small for a lot of uses that the library will be put to. - -- 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/ iEYEARECAAYFAkve8rEACgkQp9x9jeZ9/wQgngCfY7y0yAsCHtxyMUfgKgagJip4 VWEAn0gwAbZb+CzDX6WDQZT0wt205LPH =efiz -----END PGP SIGNATURE-----