spwilson 3:04 PM
Hi Seb - I'm finding that updating the data in a graph visual on each step of a sim leads to a massive slow down (up to a minute after about 1000 updates) at the end of a simulation. Should I be calling some kind of clear function after each update?
sebjames 3:24 PM
How are you doing the update? are you using GraphView::append?
3:25
Like the example in morphologica/examples/graph4.cpp?
spwilson 3:26 PM
no i'm not doing append, I'm overwriting the entire vector -- bad?!
sebjames 3:26 PM
So you're calling gv->update()?
spwilson 3:26 PM
yep
sebjames 3:26 PM
Ok, that's slower
spwilson 3:27 PM
seems like a cumulative thing, so longer I run it the slower the shutdown time (doesn't effect runtime speed)
3:27
I'll try append though
sebjames 3:27 PM
gv->append only appends the primitive objects required to add on to your preexisting graph. See graph4.cpp
3:28
What you're describing sounds a bit like the terrible slowdown problem updating HexGridVisuals, so there may be a bug (edited)
spwilson 3:28 PM
yes thats what i thought
sebjames 3:28 PM
in the update() method, which makes it slower than it should be
3:29
I'll check - I can remember what that problem was - it was a failure to clear out the OpenGL indices and vertices
3:29
Yes! Same bug
spwilson 3:29 PM
but that would slow at runtime, and get progressively worse. I don't notice runtime slowdown (printout of current time seems to increment about as long), just massive at the end, i.e., when cleqring the data
sebjames 3:30 PM
It's a one line fix
3:30
I'll do it now and push
spwilson 3:30 PM
ah yes, cool!
3:30
thanks
sebjames 3:36 PM
Hmm, I was mistaken. When you call GraphVisual::update, it updates the data and the scalings and then it calls VisualDataModel::reinit which DOES clear out vertexPositions, vertexNormals, vertexColors and indices. So I don't know why you're getting a slow down.