A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-August/091506.html below:

[Python-Dev] default of returning None hurts performance?

[Python-Dev] default of returning None hurts performance? [Python-Dev] default of returning None hurts performance?Antoine Pitrou solipsis at pitrou.net
Mon Aug 31 23:20:34 CEST 2009
Gregory P. Smith <greg <at> krypto.org> writes:
> 
> food for thought as noticed by a coworker who has been profiling some hot code
to optimize a library...If a function does not have a return statement we return
None.  Ironically this makes the foo2 function below faster than the bar2
function at least as measured using bytecode size

I would be surprised if this "bytecode size" difference made a significant
difference in runtimes, given that function call cost should dwarf the cumulated
cost of POP_TOP and LOAD_CONST (two of the simplest opcodes you could find).

Did your coworker run any timings instead of basing his assumptions on bytecode
size?

Regards

Antoine.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4