Minor opt to cache tuple casting (#3894)

This commit is contained in:
Aaron Gokaslan 2022-04-24 14:46:39 -04:00 committed by GitHub
parent 2a7cb008ac
commit 82455a41fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -647,8 +647,9 @@ private:
for (auto field : attr("fields").attr("items")()) {
auto spec = field.cast<tuple>();
auto name = spec[0].cast<pybind11::str>();
auto format = spec[1].cast<tuple>()[0].cast<dtype>();
auto offset = spec[1].cast<tuple>()[1].cast<pybind11::int_>();
auto spec_fo = spec[1].cast<tuple>();
auto format = spec_fo[0].cast<dtype>();
auto offset = spec_fo[1].cast<pybind11::int_>();
if ((len(name) == 0u) && format.kind() == 'V') {
continue;
}