Avoid creating most slice objects
We've been allocating slice objects for slicing operations, but CPython's internal slice methods already take separate start+stop arguments. So if we see a slice, instead of creating the slice and sending it off to getitem, try calling PySequence_GetSlice. This will be slower for classes with user-defined __getitem__ functions that can handle slices; we can fix that by adding rewriting to this new endpoint, but it seems to not matter too much right now.
Showing
Please register or sign in to comment