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
9256e626
Commit
9256e626
authored
Dec 25, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor performance tweaking
parent
13e8dd85
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+6
-5
No files found.
Cython/Compiler/Nodes.py
View file @
9256e626
...
@@ -2146,10 +2146,11 @@ class DefNode(FuncDefNode):
...
@@ -2146,10 +2146,11 @@ class DefNode(FuncDefNode):
for
i
,
arg
in
enumerate
(
all_args
):
for
i
,
arg
in
enumerate
(
all_args
):
if
not
arg
.
default
:
if
not
arg
.
default
:
last_required_arg
=
i
last_required_arg
=
i
if
max_positional_args
:
use_switch
=
max_positional_args
>
2
# switch has an overhead, too
if
use_switch
:
code
.
putln
(
'switch (PyTuple_GET_SIZE(%s)) {'
%
Naming
.
args_cname
)
code
.
putln
(
'switch (PyTuple_GET_SIZE(%s)) {'
%
Naming
.
args_cname
)
for
i
,
arg
in
enumerate
(
all_args
[:
last_required_arg
+
1
]):
for
i
,
arg
in
enumerate
(
all_args
[:
last_required_arg
+
1
]):
if
max_positional_args
and
i
<=
max_positional_args
:
if
use_switch
and
i
<=
max_positional_args
:
if
self
.
star_arg
and
i
==
max_positional_args
:
if
self
.
star_arg
and
i
==
max_positional_args
:
code
.
putln
(
'default:'
)
code
.
putln
(
'default:'
)
else
:
else
:
...
@@ -2167,7 +2168,7 @@ class DefNode(FuncDefNode):
...
@@ -2167,7 +2168,7 @@ class DefNode(FuncDefNode):
self
.
name
.
utf8encode
(),
arg
.
name_entry
.
pystring_cname
))
self
.
name
.
utf8encode
(),
arg
.
name_entry
.
pystring_cname
))
code
.
putln
(
code
.
error_goto
(
self
.
pos
))
code
.
putln
(
code
.
error_goto
(
self
.
pos
))
code
.
putln
(
'}'
)
code
.
putln
(
'}'
)
if
max_positional_args
:
if
use_switch
:
code
.
putln
(
'}'
)
code
.
putln
(
'}'
)
# convert arg values to their final type and assign them
# convert arg values to their final type and assign them
...
@@ -4949,7 +4950,7 @@ static int __Pyx_ParseKeywordArguments(
...
@@ -4949,7 +4950,7 @@ static int __Pyx_ParseKeywordArguments(
while (PyDict_Next(kwds, &pos, &key, &value)) {
while (PyDict_Next(kwds, &pos, &key, &value)) {
name = first_kw_arg;
name = first_kw_arg;
while (*name && (**name != key)) name++;
while (*name && (**name != key)) name++;
if (
*name
) {
if (
likely(*name)
) {
values[name-argnames] = value;
values[name-argnames] = value;
} else {
} else {
#if PY_MAJOR_VERSION < 3
#if PY_MAJOR_VERSION < 3
...
@@ -4969,7 +4970,7 @@ static int __Pyx_ParseKeywordArguments(
...
@@ -4969,7 +4970,7 @@ static int __Pyx_ParseKeywordArguments(
PyString_AS_STRING(key)) == 0) break;
PyString_AS_STRING(key)) == 0) break;
#endif
#endif
}
}
if (
*name
) {
if (
likely(*name)
) {
values[name-argnames] = value;
values[name-argnames] = value;
} else {
} else {
/* unexpected keyword found */
/* unexpected keyword found */
...
...
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