Created attachment 47444 [details] [review] Skip zero-byte-length call to memcpy() In function _cairo_path_fixed_add() (file cairo-path-fixed.c, as pulled from the Thunderbird 5.0 Beta1 source) memcpy() is frequently invoked to copy zero bytes. My observation with TB 5.0b1 is that in 16% of the calls a byte length of zero is specified. Further, the code as built by Mozilla using VS2005/VS2008 is generated as functions, not as inline intrinsics. Not a huge burden, but why incur the cost of these pointless calls to memcpy() if we don't have to?
I'd patch _cairo_path_buf_add_points() instead.
(In reply to comment #1) > I'd patch _cairo_path_buf_add_points() instead. But the entirety of _cairo_path_buf_add_points() (which is little more than a wrapper around memcpy) is pointless if the num_points variable is zero.
Sure, but why should the caller bother checking when the callee can do?
commit 1ce5d4707cf260618bd4d61f39aad4371ffa3336 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Fri Sep 16 16:11:42 2011 +0100 path: Skip calls to zero-length memcpy We attempt to copy 0 points onto the array of path points for a close-path. This is pointless and an unnecessary function call under MSVC at least. Based on a patch by Steve Snyder, incorporating Behdad's review comments. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37836 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.