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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
2d466332
Commit
2d466332
authored
7 years ago
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) {
//////////////////// AsyncGenerator ////////////////////
//@requires: AsyncGeneratorInitFinalizer
//@requires: Coroutine.c::Coroutine
//@requires: ObjectHandling.c::PyObjectCallMethod1
PyDoc_STRVAR
(
__Pyx_async_gen_send_doc
,
...
...
@@ -222,7 +223,8 @@ __Pyx_async_gen_init_hooks(__pyx_PyAsyncGenObject *o)
PyObject
*
res
;
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
);
if
(
unlikely
(
res
==
NULL
))
{
return
1
;
...
...
This diff is collapsed.
Click to expand it.
Cython/Utility/ObjectHandling.c
View file @
2d466332
...
...
@@ -1268,6 +1268,7 @@ bad:
/////////////// PyObjectCallMethod1.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 ///////////////
//@requires: PyObjectGetAttrStr
...
...
@@ -1275,10 +1276,8 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name
//@requires: PyFunctionFastCall
//@requires: PyCFunctionFastCall
static
PyObject
*
__Pyx_PyObject_CallMethod1
(
PyObject
*
obj
,
PyObject
*
method_name
,
PyObject
*
arg
)
{
PyObject
*
method
,
*
result
=
NULL
;
method
=
__Pyx_PyObject_GetAttrStr
(
obj
,
method_name
);
if
(
unlikely
(
!
method
))
goto
done
;
static
PyObject
*
__Pyx__PyObject_CallMethod1
(
PyObject
*
method
,
PyObject
*
arg
)
{
PyObject
*
result
;
#if CYTHON_UNPACK_METHODS
if
(
likely
(
PyMethod_Check
(
method
)))
{
PyObject
*
self
=
PyMethod_GET_SELF
(
method
);
...
...
@@ -1315,6 +1314,15 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name
}
#endif
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:
Py_XDECREF
(
method
);
return
result
;
...
...
This diff is collapsed.
Click to expand it.
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