projects
/
platform
/
upstream
/
python-cython.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
745d009
)
speed up slicing of lists and tuples
author
Stefan Behnel
<stefan_ml@behnel.de>
Thu, 7 Mar 2013 19:39:15 +0000
(20:39 +0100)
committer
Stefan Behnel
<stefan_ml@behnel.de>
Thu, 7 Mar 2013 19:39:15 +0000
(20:39 +0100)
Cython/Compiler/ExprNodes.py
patch
|
blob
|
history
diff --git
a/Cython/Compiler/ExprNodes.py
b/Cython/Compiler/ExprNodes.py
index
42e1293
..
b0c3dea
100755
(executable)
--- a/
Cython/Compiler/ExprNodes.py
+++ b/
Cython/Compiler/ExprNodes.py
@@
-3649,9
+3649,16
@@
class SliceIndexNode(ExprNode):
stop_code,
code.error_goto_if_null(result, self.pos)))
else:
+ if self.base.type is list_type:
+ cfunc = 'PyList_GetSlice'
+ elif self.base.type is tuple_type:
+ cfunc = 'PyTuple_GetSlice'
+ else:
+ cfunc = '__Pyx_PySequence_GetSlice'
code.putln(
- "%s =
__Pyx_PySequence_GetSlice
(%s, %s, %s); %s" % (
+ "%s =
%s
(%s, %s, %s); %s" % (
result,
+ cfunc,
self.base.py_result(),
start_code,
stop_code,