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
Kirill Smelkov
cython
Commits
a51df339
Commit
a51df339
authored
Aug 22, 2016
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
speed up non-kwargs Python function/method calls by up to 20% by avoiding tuple creation
parent
f4d72389
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+24
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
a51df339
...
...
@@ -5574,6 +5574,29 @@ class PyMethodCallNode(SimpleCallNode):
else
:
arg_offset
=
arg_offset_cname
code
.
putln
(
"#if CYTHON_FAST_PYCALL"
)
code
.
putln
(
"if (PyFunction_Check(%s)) {"
%
function
)
code
.
putln
(
"PyObject *%s[%d] = {%s, %s};"
%
(
Naming
.
quick_temp_cname
,
len
(
args
)
+
1
,
self_arg
,
', '
.
join
(
arg
.
py_result
()
for
arg
in
args
)))
code
.
putln
(
"%s = __Pyx_PyFunction_FastCall(%s, %s+1-%s, %d+%s, NULL); %s"
%
(
self
.
result
(),
function
,
Naming
.
quick_temp_cname
,
arg_offset
,
len
(
args
),
arg_offset
,
code
.
error_goto_if_null
(
self
.
result
(),
self
.
pos
)))
code
.
put_xdecref_clear
(
self_arg
,
py_object_type
)
code
.
put_gotref
(
self
.
py_result
())
for
arg
in
args
:
arg
.
generate_disposal_code
(
code
)
code
.
putln
(
"} else"
)
code
.
putln
(
"#endif"
)
code
.
putln
(
"{"
)
args_tuple
=
code
.
funcstate
.
allocate_temp
(
py_object_type
,
manage_ref
=
True
)
code
.
putln
(
"%s = PyTuple_New(%d+%s); %s"
%
(
args_tuple
,
len
(
args
),
arg_offset
,
...
...
@@ -5614,6 +5637,7 @@ class PyMethodCallNode(SimpleCallNode):
if
len
(
args
)
==
1
:
code
.
putln
(
"}"
)
code
.
putln
(
"}"
)
# !CYTHON_FAST_PYCALL
if
reuse_function_temp
:
self
.
function
.
generate_disposal_code
(
code
)
...
...
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