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/2001-November/018556.html below:

[Python-Dev] optimizing simple function calls [was PEP 275 (switching)]

[Python-Dev] optimizing simple function calls [was PEP 275 (switching)] [Python-Dev] optimizing simple function calls [was PEP 275 (switching)]Neil Schemenauer nas@python.ca
Mon, 12 Nov 2001 07:23:05 -0800
M.-A. Lemburg wrote:
>     The current solution to this problem lies in using a dispatch
>     table to find the case implementing method to execute depending on
>     the value of the switch variable (this can be tuned to have a
>     complexity of O(1) on average, e.g. by using perfect hash
>     tables). This works well for state machines which require complex
>     and lengthy processing in the different case methods. It does not
>     perform well for ones which only process one or two instructions
>     per case, e.g.
> 
>     def handle_data(self, data):
>         self.stack.append(data)

It would be nice if we could make simple methods like this faster.
Maybe something like a special fast path for methods with no blocks and
no variable or keyword arguments.  I think optimizing small functions
would be a greater overall benefit to the average Python program.

  Neil



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