Faster/simpler cumsum approach in read_point_list

Reqires a special case for ndarrays in dedup_field() -- probably a good
idea anyways if user gives us an ndarray
This commit is contained in:
Jan Petykiewicz 2020-04-18 03:00:36 -07:00
commit 6f2200c5ed
2 changed files with 11 additions and 6 deletions

View file

@ -1345,10 +1345,7 @@ def read_point_list(stream: io.BufferedIOBase) -> List[List[int]]:
elif list_type == 5:
deltas = [Delta.read(stream).as_list() for _ in range(list_len)]
if _USE_NUMPY:
delta_x, delta_y = zip(*deltas)
x = numpy.cumsum(delta_x)
y = numpy.cumsum(delta_y)
points = list(zip(x, y))
points = numpy.cumsum(deltas, axis=0)
else:
points = []
x = 0