[TIP] Interesting getattr pattern [was: Re: [issue5728] Support telling TestResult objects a test run has finished]

John Arbash Meinel john at arbash-meinel.com
Sat Apr 11 09:01:19 PDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Raphael Marvie wrote:
> In fact my question was, would any one consider the proposal I made a
> bad choice regarding performance. I am most often not limited by
> performance issues. I just like to avoid tests when I can use some kind
> of polymorphism, which I find cleaner to read. I'll remember the noop
> name instead of donothing.
> 
> r.

I'll mention that on top of the time to create a closure (create the
lambda/named function), you also encounter function call overhead. From
all of the profiling tests I've done, a conditional is *much* cheaper
than a no-op function call. AIUI, any function call has to create a
frame, and those take longer than you'd like.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkngvs8ACgkQJdeBCYSNAANCAACgvIPI1RTrNFpBVjOpLpJPFOYJ
PvAAoIAvSF8kL7Fe2uI4jO1PqwbjSMNP
=78HQ
-----END PGP SIGNATURE-----



More information about the testing-in-python mailing list