Commit c178ad0c authored by Guillaume Seguin's avatar Guillaume Seguin

Work in progress #576: Heavily optimize 2D viewer memory usage by using numpy

parent af1df4fb
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
from Queue import Queue from Queue import Queue
from collections import deque from collections import deque
import numpy
import wx import wx
import time import time
from . import gcoder from . import gcoder
...@@ -506,6 +507,11 @@ class Gviz(wx.Panel): ...@@ -506,6 +507,11 @@ class Gviz(wx.Panel):
self.arcpens[viz_layer].append(self.arcpen) self.arcpens[viz_layer].append(self.arcpen)
self.lastpos = target self.lastpos = target
# Transform into a numpy array for memory efficiency
self.lines[viz_layer] = numpy.asarray(self.lines[viz_layer])
self.pens[viz_layer] = numpy.asarray(self.pens[viz_layer])
self.arcs[viz_layer] = numpy.asarray(self.arcs[viz_layer])
self.arcpens[viz_layer] = numpy.asarray(self.arcpens[viz_layer])
# Only add layer to self.layers now to prevent the display of an # Only add layer to self.layers now to prevent the display of an
# unfinished layer # unfinished layer
self.layers[layer_idx] = viz_layer self.layers[layer_idx] = viz_layer
......
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