New submission from Serhiy Storchaka <storchaka+cpyt...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue33200>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to