poor performance of [draw] objects
Drawing a large amount of [draw] objects results in a poor performance.
Without knowing Purr Datas code I suspect that [draw] objects are created by drawing on canvases in html5. I guess, they are handled somehow like this (in javascript):
cnv = document.getElementById("some_canvas")
ctx = cnv.getContext("2d")
ctx.fillRect(x,y,w,h)
This seemes to be called every time one [draw] object is drawn and causes a poor performance.
As I was working on a sequencer for pd with nw.js, I discovered that using a ctx.beginPath() before objects are drawn increases the performance enormous. Therefore all objects have to be collected before. The code would look like this:
collect_rects -> rect_array
cnv = document.getElementById("some_canvas")
ctx = cnv.getContext("2d")
ctx.beginPath()
for (i = 0; i < rect_array.length ; i++) {
ctx.fillRect(x,y,w,h)
}
See also the discussion here:
https://stackoverflow.com/questions/16653905/html5-canvas-performance-very-poor-using-rect