Commit e0bfc291 authored by Marius Wachtler's avatar Marius Wachtler

_listSlice: if step is 1 use listAppendArrayInternal

reduces runtime of fannkuch.py by about 0.8 secs
parent 761f690a
......@@ -105,11 +105,16 @@ Box* _listSlice(BoxedList *self, i64 start, i64 stop, i64 step) {
BoxedList *rtn = new BoxedList();
int cur = start;
while ((step > 0 && cur < stop) || (step < 0 && cur > stop)) {
listAppendInternal(rtn, self->elts->elts[cur]);
cur += step;
if ((step == 1) && ((stop-start) > 0)) {
listAppendArrayInternal(rtn, &self->elts->elts[start], stop-start);
} else {
int cur = start;
while ((step > 0 && cur < stop) || (step < 0 && cur > stop)) {
listAppendInternal(rtn, self->elts->elts[cur]);
cur += step;
}
}
return rtn;
}
......
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