Protocols to remove abstraction overhead #400
Labels
API design
HPy update in GraalPy
This change requires a related change in GraalPy
HPy update in PyPy
This change requires a related change in PyPy
Protocols can help remove abstraction overhead when possible. For example,
consider the case of iterating over a sequence (list, tuple, array.array, etc.)
that happens to contain integers.
Design goals
Expose internal data representations, which might be more efficient than
objects.
Make the direct access to native data structures explicit to allow
implementors to adapt without being bound to internal details.
Keep the API similar for both simple object access and optimised data
structures.
Considering the iteration protocol, which would look as follows:
Optimised variant when a sequence of C long integers is expected:
(copied from docs/misc/protocols.rst)
The text was updated successfully, but these errors were encountered: