PEP 572: Add a short section on performance
This commit is contained in:
parent
abf11d2954
commit
b2d428ce48
17
pep-0572.rst
17
pep-0572.rst
|
@ -84,6 +84,23 @@ avoided where regular assignment can be used, just as ``lambda`` should be
|
|||
avoided when ``def`` is an option.
|
||||
|
||||
|
||||
Performance costs
|
||||
=================
|
||||
|
||||
The cost of SLNBs must be kept to a minimum, particularly when they are not
|
||||
used; the normal case MUST NOT be measurably penalized. SLNBs are expected
|
||||
to be uncommon, and using many of them in a single function should definitely
|
||||
be discouraged. Thus the current implementation uses a linked list of SLNB
|
||||
cells, with the absence of such a list being the normal case. This list is
|
||||
used for code compilation only; once a function's bytecode has been baked in,
|
||||
execution of that bytecode has no performance cost compared to regular
|
||||
assignment.
|
||||
|
||||
Other Python implementations may choose to do things differently, but a zero
|
||||
run-time cost is strongly recommended, as is a minimal compile-time cost in
|
||||
the case where no SLNBs are used.
|
||||
|
||||
|
||||
Open questions
|
||||
==============
|
||||
|
||||
|
|
Loading…
Reference in New Issue