Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
2d466332
Commit
2d466332
authored
Aug 01, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimise call to asyncio "firstiter" method for async generators
parent
49d0e464
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
Cython/Utility/AsyncGen.c
Cython/Utility/AsyncGen.c
+3
-1
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+12
-4
No files found.
Cython/Utility/AsyncGen.c
View file @
2d466332
...
@@ -100,6 +100,7 @@ static int __Pyx_async_gen_init_hooks(__pyx_PyAsyncGenObject *o) {
...
@@ -100,6 +100,7 @@ static int __Pyx_async_gen_init_hooks(__pyx_PyAsyncGenObject *o) {
//////////////////// AsyncGenerator ////////////////////
//////////////////// AsyncGenerator ////////////////////
//@requires: AsyncGeneratorInitFinalizer
//@requires: AsyncGeneratorInitFinalizer
//@requires: Coroutine.c::Coroutine
//@requires: Coroutine.c::Coroutine
//@requires: ObjectHandling.c::PyObjectCallMethod1
PyDoc_STRVAR
(
__Pyx_async_gen_send_doc
,
PyDoc_STRVAR
(
__Pyx_async_gen_send_doc
,
...
@@ -222,7 +223,8 @@ __Pyx_async_gen_init_hooks(__pyx_PyAsyncGenObject *o)
...
@@ -222,7 +223,8 @@ __Pyx_async_gen_init_hooks(__pyx_PyAsyncGenObject *o)
PyObject
*
res
;
PyObject
*
res
;
Py_INCREF
(
firstiter
);
Py_INCREF
(
firstiter
);
res
=
__Pyx_PyObject_CallOneArg
(
firstiter
,
(
PyObject
*
)
o
);
// at least asyncio stores methods here => optimise the call
res
=
__Pyx__PyObject_CallMethod1
(
firstiter
,
(
PyObject
*
)
o
);
Py_DECREF
(
firstiter
);
Py_DECREF
(
firstiter
);
if
(
unlikely
(
res
==
NULL
))
{
if
(
unlikely
(
res
==
NULL
))
{
return
1
;
return
1
;
...
...
Cython/Utility/ObjectHandling.c
View file @
2d466332
...
@@ -1268,6 +1268,7 @@ bad:
...
@@ -1268,6 +1268,7 @@ bad:
/////////////// PyObjectCallMethod1.proto ///////////////
/////////////// PyObjectCallMethod1.proto ///////////////
static
PyObject
*
__Pyx_PyObject_CallMethod1
(
PyObject
*
obj
,
PyObject
*
method_name
,
PyObject
*
arg
);
/*proto*/
static
PyObject
*
__Pyx_PyObject_CallMethod1
(
PyObject
*
obj
,
PyObject
*
method_name
,
PyObject
*
arg
);
/*proto*/
static
PyObject
*
__Pyx__PyObject_CallMethod1
(
PyObject
*
method
,
PyObject
*
arg
);
/*proto*/
/////////////// PyObjectCallMethod1 ///////////////
/////////////// PyObjectCallMethod1 ///////////////
//@requires: PyObjectGetAttrStr
//@requires: PyObjectGetAttrStr
...
@@ -1275,10 +1276,8 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name
...
@@ -1275,10 +1276,8 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name
//@requires: PyFunctionFastCall
//@requires: PyFunctionFastCall
//@requires: PyCFunctionFastCall
//@requires: PyCFunctionFastCall
static
PyObject
*
__Pyx_PyObject_CallMethod1
(
PyObject
*
obj
,
PyObject
*
method_name
,
PyObject
*
arg
)
{
static
PyObject
*
__Pyx__PyObject_CallMethod1
(
PyObject
*
method
,
PyObject
*
arg
)
{
PyObject
*
method
,
*
result
=
NULL
;
PyObject
*
result
;
method
=
__Pyx_PyObject_GetAttrStr
(
obj
,
method_name
);
if
(
unlikely
(
!
method
))
goto
done
;
#if CYTHON_UNPACK_METHODS
#if CYTHON_UNPACK_METHODS
if
(
likely
(
PyMethod_Check
(
method
)))
{
if
(
likely
(
PyMethod_Check
(
method
)))
{
PyObject
*
self
=
PyMethod_GET_SELF
(
method
);
PyObject
*
self
=
PyMethod_GET_SELF
(
method
);
...
@@ -1315,6 +1314,15 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name
...
@@ -1315,6 +1314,15 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name
}
}
#endif
#endif
result
=
__Pyx_PyObject_CallOneArg
(
method
,
arg
);
result
=
__Pyx_PyObject_CallOneArg
(
method
,
arg
);
done:
return
result
;
}
static
PyObject
*
__Pyx_PyObject_CallMethod1
(
PyObject
*
obj
,
PyObject
*
method_name
,
PyObject
*
arg
)
{
PyObject
*
method
,
*
result
;
method
=
__Pyx_PyObject_GetAttrStr
(
obj
,
method_name
);
if
(
unlikely
(
!
method
))
goto
done
;
result
=
__Pyx__PyObject_CallMethod1
(
method
,
arg
);
done:
done:
Py_XDECREF
(
method
);
Py_XDECREF
(
method
);
return
result
;
return
result
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment