Commit 916df4d2 authored by Stefan Behnel's avatar Stefan Behnel

speed up slicing of lists and tuples

parent 745d0091
...@@ -3649,9 +3649,16 @@ class SliceIndexNode(ExprNode): ...@@ -3649,9 +3649,16 @@ class SliceIndexNode(ExprNode):
stop_code, stop_code,
code.error_goto_if_null(result, self.pos))) code.error_goto_if_null(result, self.pos)))
else: 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( code.putln(
"%s = __Pyx_PySequence_GetSlice(%s, %s, %s); %s" % ( "%s = %s(%s, %s, %s); %s" % (
result, result,
cfunc,
self.base.py_result(), self.base.py_result(),
start_code, start_code,
stop_code, stop_code,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment