
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/05/2010 11:01 AM, Stewart, Robert wrote:
It's quite minuscule. I'm no CPU hardware expert, but my educated guess would be two additional clock cycles per comparison at most. I'll take that cost over the cost of duplicating the logic in multiple functions, especially as it's not trivial.
I wasn't referring to the comparisons in the operator functions, but rather to the logic in compare() that must produce one of three results; I can't tell if we're talking about the same thing.
That's what I was talking about too, and why I estimated that it added two clock cycles, instead of the single one that is all the comparison alone would warrant.
When implementing the operators directly, there are shortcuts in the logic you can't take in compare(): [...]
I appreciate that, but I don't consider the extremely small time savings to be worth the duplication of code, with all the costs that entails, such as the increased chance that a change that should go in both would only make it into one of them, and the extra tests required to ensure full coverage. - -- 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/ iEYEARECAAYFAkvhww0ACgkQp9x9jeZ9/wQBsQCgwqYpkMvaylVeuwAr6dc2BeWG uo8An2qml14Kav/sYNlkWnZQJMV0nyKz =MD/p -----END PGP SIGNATURE-----