heavy lag under MacOs, when removing a node

Hello there,

I’m testing my project under a MacOS X, and I suffer a heavy lag. It seems to occur when I call node.removeNode() on a procedurally generated node.

My program create a new GeomNode each 3 seconds. During the 3 following seconds, I dynamically adds some vertex into its Geom, and modify its Primitive.

After the 3 seconds ended, I call a function which do the node.removeNode(). If i remove the removeNode call, the lag disappear. Also, the lag doesn’t occur on my PC (under Ubuntu 9.04)

Using pstats, I obtained this image:

I seems there are a lot too much erase calls. Do anybody knows why?

If needed, I would provide other screenshots, code.

Thanks,

Amarok

Hmm, you must be adding a lot of pieces of geometry–more than 2000 elements. Are you creating 2000 little GeomVertexData objects, or 2000 little GeomPrimitives? If so, it might be much better to create one or two large ones instead.

David

Hello David,

Thanks for your answer. Unluckily, I’m now working on other part of my project, and I have replaced the buggy piece code, by an older one (which isn’t optimized, bug don’t cause the lag).

As soon as I would work again on this, I would decribe you my problem.
I just insist on the fact this bug appears only on MacOsX, not on ubuntu 9.04, and that the bug happened as I was trying to diminish the numer of geoms.

Thanks again

Amarok

Right, it just means it behaves differently on different drivers. That’s not surprising, because GeomVertexDatas only have to be added to the cache if they are not already in the appropriate format for the rendering API in use.

There are lots of ways to avoid the problem of adding all of your GeomVertexDatas into the cache. You could choose an appropriate format to match your hardware’s requirements in the first place; you could disable the cache altogether with ‘geom-cache-size 0’, or you could limit the size of the cache or change the cache at runtime according to your needs. All of these approaches, though, are really just sidestepping around the real problem: you shouldn’t be generating thousands of GeomVertexDatas if you can avoid it. It’s much more efficient, in all contexts, to generate only a few large GeomVertexDatas than many small ones.

David