diff options
| author | Stella Laurenzo <stellaraccident@gmail.com> | 2022-02-13 22:49:28 -0800 |
|---|---|---|
| committer | Stella Laurenzo <stellaraccident@gmail.com> | 2022-02-14 09:45:17 -0800 |
| commit | 429b0cf1de14471c9d258467bfc9936c3a9d52f7 (patch) | |
| tree | 1a764b90d0e165269ece9c67ee7fac6251bee3f9 /llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp | |
| parent | e404e22587867a1bbdac125e8419440c6929daa0 (diff) | |
[mlir][python] Directly implement sequence protocol on Sliceable.
* While annoying, this is the only way to get C++ exception handling out of the happy path for normal iteration.
* Implements sq_length and sq_item for the sequence protocol (used for iteration, including list() construction).
* Implements mp_subscript for general use (i.e. foo[1] and foo[1:1]).
* For constructing a `list(op.results)`, this reduces the time from ~4-5us to ~1.5us on my machine (give or take measurement overhead) and eliminates C++ exceptions, which is a worthy goal in itself.
* Compared to a baseline of similar construction of a three-integer list, which takes 450ns (might just be measuring function call overhead).
* See issue discussed on the pybind side: https://github.com/pybind/pybind11/issues/2842
Differential Revision: https://reviews.llvm.org/D119691
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp')
0 files changed, 0 insertions, 0 deletions
