Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Cecil Westerhof Newsgroups: comp.lang.python Subject: Re: Is this a good way to implement testing Date: Sun, 03 May 2015 12:50:37 +0200 Organization: Decebal Computing Lines: 21 Message-ID: <87618akk8y.fsf@Equus.decebal.nl> References: <878ud6mx4y.fsf@Equus.decebal.nl> <87383em7sn.fsf@Equus.decebal.nl> <87iocakn2f.fsf@Equus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="1e75f8f7bcfe2945d0316cb03b0f6951"; logging-data="5290"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Kb7m4T7E3zAcRMWkft3VjnGspzDIx+N8=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-Face: "(y8cC@tg_12{">GF'UXTW]FHI2wMiZNrnf'1EFQ&O#$m:f#O7+7}kR,v+Pti8=Vi/Z"g^?b"E Cancel-Lock: sha1:Pcy7vAMKPugodTBg2GHcY3+RiTc= sha1:gHqFRNl6MeO/AgF4JHisOxBEiBQ= X-Homepage: http://www.decebal.nl/ Xref: csiph.com comp.lang.python:89855 Op Sunday 3 May 2015 12:21 CEST schreef Mark Lawrence: >> That looks very promising. But I use the test to verify the >> correctness and show the performance. Is that also possible? Or >> should I split those out. >> > > Get it working correctly and if it's fast enough for your needs then > job done. If and only if you actually have a performance issue > profile your code to find the bottlenecks, as gut instinct about > Python performance is wrong 99.99% of the time. I'll split them out. One is to verify the correctness, the other is to show the difference between implementations. For example: even with memoization the recursive version of fibonacci is much slower as the iterative version. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof