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/2015-January/137831.html below:

[Python-Dev] Why does STORE_MAP not take a parameter?

[Python-Dev] Why does STORE_MAP not take a parameter? [Python-Dev] Why does STORE_MAP not take a parameter?Greg Ewing greg.ewing at canterbury.ac.nz
Thu Jan 22 00:57:30 CET 2015
On 01/21/2015 11:16 PM, Neil Girdhar wrote:
> Why not have BUILD_MAP work like BUILD_LIST?   I.e., STORE_MAP takes a
> parameter n and adds the last n pairs of stack elements into the n-1 stack
> element (the dictionary).

It probably wouldn't make much difference. Building a list is
substantially cheaper if you have all the items on hand and can
copy them in en masse. But adding an item to a dict entails
quite a lot of overhead, since you need to hash the key, look
for a free slot, etc. and this would likely swamp any gain
from executing less bytecodes. And on the other side of the
equation, evaluating the items one at a time requires less
stack space, so the stack frame can be smaller.

But as always, you can't be sure without measuring it, and
this would be a good thing for someone interested to try out.

-- 
Greg

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