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/2005-September/056399.html below:

[Python-Dev] speeding up list append calls

[Python-Dev] speeding up list append calls [Python-Dev] speeding up list append calls"Martin v. Löwis" martin at v.loewis.de
Wed Sep 14 18:55:12 CEST 2005
Neal Norwitz wrote:
> This code doesn't really work in general.  It assumes that any append
> function call is a list method, which is obviously invalid.  But if a
> variable is known to be a list (ie, local and assigned as list
> (BUILD_LIST) or a list comprehension), could we do something like this
> as a peephole optimization?

Alternatively, couldn't LIST_APPEND check that this really is a list,
and, if it isn't, fall back to PyObject_CallMethod?

Not sure which .append call is performed most frequently, but the
traditional trick of caching x.append in a local variable might give
you most of the speedup.

Regards,
Martin
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