Skip to content

Commit cc10782

Browse files
committed
[perf] optimize __4py function
1 parent 2a2259c commit cc10782

30 files changed

Lines changed: 97 additions & 90 deletions

‎python/PyCGraph.cpp‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,13 @@ PYBIND11_MODULE(pycgraph, cg) {
141141

142142
py::class_<GAspect, PywGAspect, std::unique_ptr<GAspect, py::nodelete> >(cg, "GAspect")
143143
.def(py::init<>())
144-
.def("getName", &GAspect::__getName_4py)
144+
.def("getName", &GAspect::__getName_4expose)
145145
.PYCGRAPH_DEF_GPARAM_PYBIND11_FUNCTIONS(GAspect)
146146
.PYCGRAPH_DEF_GEVENT_PYBIND11_FUNCTIONS(GAspect);
147147

148148
py::class_<GDaemon, PywGDaemon, std::unique_ptr<GDaemon, py::nodelete> >(cg, "GDaemon")
149149
.def(py::init<>())
150-
.def("getInterval", &GDaemon::__getInterval_4py)
150+
.def("getInterval", &GDaemon::__getInterval_4expose)
151151
.PYCGRAPH_DEF_GPARAM_PYBIND11_FUNCTIONS(GDaemon)
152152
.PYCGRAPH_DEF_GEVENT_PYBIND11_FUNCTIONS(GDaemon);
153153

@@ -212,15 +212,15 @@ PYBIND11_MODULE(pycgraph, cg) {
212212
py::arg("runTimes") = 1,
213213
py::call_guard<py::gil_scoped_release>())
214214
.def("destroy", &GPipeline::destroy)
215-
.def("addGEvent", &GPipeline::__addGEvent_4py,
215+
.def("addGEvent", &GPipeline::__addGEvent_4expose,
216216
py::arg("event"),
217217
py::arg("key"),
218218
py::keep_alive<1, 2>())
219-
.def("addGDaemon", &GPipeline::__addGDaemon_4py,
219+
.def("addGDaemon", &GPipeline::__addGDaemon_4expose,
220220
py::arg("daemon"),
221221
py::arg("ms"),
222222
py::keep_alive<1, 2>())
223-
.def("addGStage", &GPipeline::__addGStage_4py,
223+
.def("addGStage", &GPipeline::__addGStage_4expose,
224224
py::arg("stage"),
225225
py::arg("key"),
226226
py::arg("threshold"),
@@ -238,17 +238,17 @@ PYBIND11_MODULE(pycgraph, cg) {
238238
py::call_guard<py::gil_scoped_release>())
239239
.def("resume", &GPipeline::resume,
240240
py::call_guard<py::gil_scoped_release>())
241-
.def("perf", &GPipeline::__perf_4py,
241+
.def("perf", &GPipeline::__perf_4expose,
242242
py::call_guard<py::gil_scoped_release>())
243-
.def("dump", &GPipeline::__dump_4py)
243+
.def("dump", &GPipeline::__dump_4expose)
244244
.def("trim", &GPipeline::trim)
245245
.def("makeSerial", &GPipeline::makeSerial)
246246
.def("getMaxPara", &GPipeline::getMaxPara)
247247
.def("getCurState", &GPipeline::getCurState)
248248
.def("checkSeparate", &GPipeline::checkSeparate,
249249
py::arg("fst"),
250250
py::arg("snd"))
251-
.def("registerGElement", &GPipeline::__registerGElement_4py,
251+
.def("registerGElement", &GPipeline::__registerGElement_4expose,
252252
py::arg("element"),
253253
py::arg("depends") = GElementPtrSet{},
254254
py::arg("name") = CGRAPH_EMPTY,
@@ -278,10 +278,10 @@ PYBIND11_MODULE(pycgraph, cg) {
278278

279279
py::class_<GElement, PywGElement, std::unique_ptr<GElement, py::nodelete> >(cg, "GElement")
280280
.def(py::init<>())
281-
.def("__str__", &GElement::__str_4py)
281+
.def("__str__", &GElement::__str_4expose)
282282
.PYCGRAPH_DEF_GPARAM_PYBIND11_FUNCTIONS(GElement)
283283
.PYCGRAPH_DEF_GEVENT_PYBIND11_FUNCTIONS(GElement)
284-
.def("enterStage", &GElement::__enterStage_4py,
284+
.def("enterStage", &GElement::__enterStage_4expose,
285285
py::arg("key"),
286286
py::call_guard<py::gil_scoped_release>())
287287
.def("getName", &GElement::getName)
@@ -302,11 +302,11 @@ PYBIND11_MODULE(pycgraph, cg) {
302302
.def("setTimeout", &GElement::setTimeout,
303303
py::arg("timeout"),
304304
py::arg("strategy") = GElementTimeoutStrategy::AS_ERROR)
305-
.def("isTimeout", &GElement::__isTimeout_4py)
305+
.def("isTimeout", &GElement::__isTimeout_4expose)
306306
.def("isGGroup", &GElement::isGGroup)
307307
.def("isGAdaptor", &GElement::isGAdaptor)
308308
.def("isGNode", &GElement::isGNode)
309-
.def("addGAspect", &GElement::__addGAspect_4py,
309+
.def("addGAspect", &GElement::__addGAspect_4expose,
310310
py::arg("aspect"),
311311
py::keep_alive<1, 2>())
312312
.def("addDependGElements", &GElement::addDependGElements,

‎python/setup.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
Extension(
4545
name=__PYCGRAPH_NAME__,
4646
sources=_sources,
47+
define_macros=[("CGRAPH_EXPOSE_INTERNALS", None)],
4748
extra_compile_args=_extra_compile_args,
4849
include_dirs=_include_dirs,
4950
extra_link_args=_extra_link_args,

‎python/wrapper/PyWrapperMacro.h‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,38 +49,38 @@ protected:
4949
.def(py::init<const GElementPtrArr&>(), \
5050
py::arg("elements") = GElementPtrArr{}, \
5151
py::keep_alive<1, 2>()) \
52-
.def("addGElements", &Pyw##PCGG::__addGElements_4py, \
52+
.def("addGElements", &Pyw##PCGG::__addGElements_4expose, \
5353
py::arg("elements"), \
5454
py::keep_alive<1, 2>()) \
5555
\
5656

5757

5858
#define PYCGRAPH_DEF_GPARAM_PYBIND11_FUNCTIONS(PCGO) \
59-
def("createGParam", &PCGO::__createGParam_4py, \
59+
def("createGParam", &PCGO::__createGParam_4expose, \
6060
py::arg("param"), \
6161
py::arg("key"), \
6262
py::keep_alive<1, 2>(), \
6363
py::call_guard<py::gil_scoped_release>()) \
64-
.def("getGParam", &PCGO::__getGParam_4py, \
64+
.def("getGParam", &PCGO::__getGParam_4expose, \
6565
py::arg("key")) \
66-
.def("getGParamWithNoEmpty", &PCGO::__getGParamWithNoEmpty_4py, \
66+
.def("getGParamWithNoEmpty", &PCGO::__getGParamWithNoEmpty_4expose, \
6767
py::arg("key")) \
68-
.def("removeGParam", &PCGO::__removeGParam_4py, \
68+
.def("removeGParam", &PCGO::__removeGParam_4expose, \
6969
py::arg("key"), \
7070
py::call_guard<py::gil_scoped_release>()) \
71-
.def("hasGParam", &PCGO::__hasGParam_4py, \
71+
.def("hasGParam", &PCGO::__hasGParam_4expose, \
7272
py::arg("key"), \
7373
py::call_guard<py::gil_scoped_release>()) \
7474
\
7575

7676

7777
#define PYCGRAPH_DEF_GEVENT_PYBIND11_FUNCTIONS(PCGO) \
78-
def("notify", &PCGO::__notify_4py, \
78+
def("notify", &PCGO::__notify_4expose, \
7979
py::arg("key"), \
8080
py::arg("type"), \
8181
py::arg("strategy") = GEventAsyncStrategy::PIPELINE_RUN_FINISH, \
8282
py::call_guard<py::gil_scoped_release>()) \
83-
.def("asyncNotify", &PCGO::__asyncNotify_4py, \
83+
.def("asyncNotify", &PCGO::__asyncNotify_4expose, \
8484
py::arg("key"), \
8585
py::arg("strategy") = GEventAsyncStrategy::PIPELINE_RUN_FINISH, \
8686
py::call_guard<py::gil_scoped_release>()) \

‎python/wrapper/PywGCluster.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class PywGCluster : public CGraph::GCluster {
1616
public:
1717
explicit PywGCluster(const CGraph::GElementPtrArr& elements = CGraph::GElementPtrArr{}) {
18-
__addGElements_4py(elements);
18+
__addGElements_4expose(elements);
1919
}
2020

2121
~PywGCluster() override = default;

‎python/wrapper/PywGCondition.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class PywGCondition : public CGraph::GCondition {
1818
public:
1919
explicit PywGCondition(const CGraph::GElementPtrArr& elements = CGraph::GElementPtrArr{}) {
20-
__addGElements_4py(elements);
20+
__addGElements_4expose(elements);
2121
}
2222
~PywGCondition() override = default;
2323

‎python/wrapper/PywGMutable.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class PywGMutable : public CGraph::GMutable {
1818
public:
1919
explicit PywGMutable(const CGraph::GElementPtrArr& elements = CGraph::GElementPtrArr{}) {
20-
__addGElements_4py(elements);
20+
__addGElements_4expose(elements);
2121
}
2222
~PywGMutable() override = default;
2323

‎python/wrapper/PywGParallelMultiCondition.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class PywGParallelMultiCondition : public CGraph::GMultiCondition<CGraph::GMultiConditionType::PARALLEL> {
1616
public:
1717
explicit PywGParallelMultiCondition(const CGraph::GElementPtrArr& elements = CGraph::GElementPtrArr{}) {
18-
CGraph::GMultiCondition<CGraph::GMultiConditionType::PARALLEL>::__addGElements_4py(elements);
18+
CGraph::GMultiCondition<CGraph::GMultiConditionType::PARALLEL>::__addGElements_4expose(elements);
1919
};
2020

2121
~PywGParallelMultiCondition() override = default;

‎python/wrapper/PywGRegion.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class PywGRegion : public CGraph::GRegion {
1616
public:
1717
explicit PywGRegion(const CGraph::GElementPtrArr& elements = CGraph::GElementPtrArr{}) {
18-
__addGElements_4py(elements);
18+
__addGElements_4expose(elements);
1919
};
2020

2121
~PywGRegion() override = default;

‎python/wrapper/PywGSerialMultiCondition.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class PywGSerialMultiCondition : public CGraph::GMultiCondition<CGraph::GMultiConditionType::SERIAL> {
1616
public:
1717
explicit PywGSerialMultiCondition(const CGraph::GElementPtrArr& elements = CGraph::GElementPtrArr{}) {
18-
CGraph::GMultiCondition<CGraph::GMultiConditionType::SERIAL>::__addGElements_4py(elements);
18+
CGraph::GMultiCondition<CGraph::GMultiConditionType::SERIAL>::__addGElements_4expose(elements);
1919
};
2020

2121
~PywGSerialMultiCondition() override = default;

‎python/wrapper/PywGSome.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class PywGSome : public CGraph::GSome {
1818
public:
1919
explicit PywGSome(const CGraph::GElementPtrArr& elements = CGraph::GElementPtrArr{}) {
20-
__addGElements_4py(elements);
20+
__addGElements_4expose(elements);
2121
}
2222
~PywGSome() override = default;
2323

0 commit comments

Comments
 (0)