[New-bugs-announce] [issue33200] Optimize the empty set "literal"

Serhiy Storchaka report at bugs.python.org
Sun Apr 1 06:29:26 EDT 2018


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

The following PR optimizes bytecode for the empty set "literal": {*()}.

Currently it is compiled to

    LOAD_CONST               0 (())
    BUILD_SET_UNPACK         1

It will optimized to

    BUILD_SET                0

$ ./python -m perf timeit --duplicate 1000 '{*()}'

Unpatched:  Mean +- std dev: 68.6 ns +- 1.1 ns
Patched:    Mean +- std dev: 31.8 ns +- 2.8 ns

----------
components: Interpreter Core
messages: 314769
nosy: benjamin.peterson, brett.cannon, ncoghlan, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: Optimize the empty set "literal"
type: performance
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33200>
_______________________________________


More information about the New-bugs-announce mailing list