Skip to content

Commit 69ee5a8

Browse files
authored
perf: nogil ops (#662)
1 parent 0ea3e97 commit 69ee5a8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

include/bh_python/register_histogram.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ auto register_histogram(py::module& m, const char* name, const char* desc) {
173173
.def(
174174
"sum",
175175
[](const histogram_t& self, bool flow) {
176+
py::gil_scoped_release release;
176177
return bh::algorithm::sum(
177178
self, flow ? bh::coverage::all : bh::coverage::inner);
178179
},
@@ -181,19 +182,22 @@ auto register_histogram(py::module& m, const char* name, const char* desc) {
181182
.def(
182183
"empty",
183184
[](const histogram_t& self, bool flow) {
185+
py::gil_scoped_release release;
184186
return bh::algorithm::empty(
185187
self, flow ? bh::coverage::all : bh::coverage::inner);
186188
},
187189
"flow"_a = false)
188190

189191
.def("reduce",
190192
[](const histogram_t& self, py::args args) {
193+
py::gil_scoped_release release;
191194
return bh::algorithm::reduce(
192195
self, py::cast<std::vector<bh::algorithm::reduce_command>>(args));
193196
})
194197

195198
.def("project",
196199
[](const histogram_t& self, py::args values) {
200+
py::gil_scoped_release release;
197201
return bh::algorithm::project(self,
198202
py::cast<std::vector<unsigned>>(values));
199203
})

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import nox
22

3-
ALL_PYTHONS = ["3.6", "3.7", "3.8", "3.9"]
3+
ALL_PYTHONS = ["3.6", "3.7", "3.8", "3.9", "3.10"]
44

55
nox.options.sessions = ["lint", "tests"]
66

0 commit comments

Comments
 (0)