[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] 2D vector class
On Wednesday 23 August 2006 02:57, Lenard Lindstrom wrote:
> ... The instance dict is searched only if one is not
> found. So having a descriptor reduces the search time. And a slot
> descriptor does not do a dict lookup. So slots should be faster,
> though I have not confirmed it.
The function call overhead (for the getter) is much greater than the fallback
to a dict lookup (which is insanely fast). We did some optimisation of
function calls at the Need For Speed sprint in Iceland, but I only managed to
squeeze out a 5% improvement (aka "noise") and others didn't fare much
better. I'd be interested to see some *actual* numbers, but I'd be surprised
if slots are faster than regular attributes. Unless there's been some
slot-specific optimisation I've missed along the way :)
Richard