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
8406b3ea
Commit
8406b3ea
authored
Jun 22, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reduce some unnecessary overhead in fused types runtime dispatch code
parent
37264625
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
Cython/Compiler/FusedNode.py
Cython/Compiler/FusedNode.py
+17
-10
No files found.
Cython/Compiler/FusedNode.py
View file @
8406b3ea
...
...
@@ -404,12 +404,15 @@ class FusedCFuncDefNode(StatListNode):
if
pyx_code
.
indenter
(
u"while 1:"
):
pyx_code
.
put_chunk
(
u"""
if n
ump
y is not None:
if isinstance(arg, n
umpy.n
darray):
if n
darra
y is not None:
if isinstance(arg, ndarray):
dtype = arg.dtype
elif (__pyx_memoryview_check(arg) and
isinstance(arg.base, numpy.ndarray)):
dtype = arg.base.dtype
elif __pyx_memoryview_check(arg):
arg_base = arg.base
if isinstance(arg_base, ndarray):
dtype = arg_base.dtype
else:
dtype = None
else:
dtype = None
...
...
@@ -417,7 +420,7 @@ class FusedCFuncDefNode(StatListNode):
if dtype is not None:
itemsize = dtype.itemsize
kind = ord(dtype.kind)
dtype_signed = kind ==
ord('i')
dtype_signed = kind ==
'i'
"""
)
pyx_code
.
indent
(
2
)
pyx_code
.
named_insertion_point
(
"numpy_dtype_checks"
)
...
...
@@ -462,10 +465,12 @@ class FusedCFuncDefNode(StatListNode):
pyx_code
.
imports
.
put_chunk
(
u"""
cdef type ndarray
try:
import numpy
except ImportError:
numpy = None
ndarray = numpy.ndarray
except (ImportError, AttributeError, TypeError):
ndarray = None
"""
)
seen_int_dtypes
=
set
()
...
...
@@ -519,7 +524,7 @@ class FusedCFuncDefNode(StatListNode):
elif '{{arg.name}}' in kwargs:
arg = kwargs['{{arg.name}}']
else:
{{if arg.default
:
}}
{{if arg.default}}
arg = defaults[{{default_idx}}]
{{else}}
raise TypeError("Expected at least %d arguments" % len(args))
...
...
@@ -556,7 +561,9 @@ class FusedCFuncDefNode(StatListNode):
pyx_code
.
put_chunk
(
u"""
def __pyx_fused_cpdef(signatures, args, kwargs, defaults):
def __pyx_fused_cpdef(dict signatures not None,
tuple args not None, dict kwargs, tuple defaults not None):
dest_sig = [{{for _ in range(n_fused)}}None,{{endfor}}]
if kwargs is None:
...
...
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