Repository navigation
Conversation
Documentation build overview
|
|
I ran a benchmark on Fedora 45 with CPU isolation and Python built with Free Threading: The benchmark only create set objects. See #160154 (comment) for benchmarks on frozenset objects. Benchmark files: Results all together:
Columns:
Compare
Compare
Compare
|
Use the new API in: * Modules/_abc.c * Modules/_asynciomodule.c * Modules/_hashopenssl.c * Modules/_ssl.c
PySetBuilder C APIPySetBuilder C API
Unrelated failure. A FTP test of test_urllib2net failed with "425 Security: Bad IP connecting":
|
| { | ||
| int ret = -1; | ||
| PyObject *abstracts = PyFrozenSet_New(NULL); | ||
| PySetBuilder *abstracts = PySetBuilder_CreateFrozenSet(0); |
There was a problem hiding this comment.
I honestly don't like the naming PySetBuilder_CreateFrozenSet but I don't have anything better to suggest. It's... a bit weird to have the combination of a builder and "create" at the same time. Maybe PySetBuilder_ForFrozenSet though PySetBuilder_ForSet is really weird as well.
If you plan to have more builder APIs such as PyFastSequenceBuilder_CreateList()/CreateTuple, feel free to ignore this comment though.
|
The API is being discussed at capi-workgroup/decisions#119. |
This PR is based on PR gh-160154. It renames
PyFrozenSetWritertoPyFrozenSetBuilder, and adds the ability to also create set objects, not only frozenset objects.Use the new API in:
When building a set, PySet_Add() suffers from the same performance issue than PyList_Add() on Free Threading (issue gh-158660): each call needs a critical section.
PyFrozenWriterC API to create afrozensetobject #160147