Merge pull request #15 from jcushman/patch-1
2x faster layout analysis: Use set instead of list for Plane's internal collection of objects.pull/1/head
commit
19e7d70ac1
|
@ -246,7 +246,7 @@ class ObjIdRange(object):
|
|||
class Plane(object):
|
||||
|
||||
def __init__(self, objs=None, gridsize=50):
|
||||
self._objs = []
|
||||
self._objs = set()
|
||||
self._grid = {}
|
||||
self.gridsize = gridsize
|
||||
if objs is not None:
|
||||
|
@ -281,7 +281,7 @@ class Plane(object):
|
|||
else:
|
||||
r = self._grid[k]
|
||||
r.append(obj)
|
||||
self._objs.append(obj)
|
||||
self._objs.add(obj)
|
||||
return
|
||||
|
||||
# remove(obj): displace an object.
|
||||
|
|
Loading…
Reference in New Issue