Nitin.Jain wrote: > Hi Doug, > > I'm attaching the source code where I'm creating 1000 sphere and it takes > around 7 secs to render it. If I increase this number to 15000 it takes 100+ > secs, however in both the cases initial number of spheres visible on the > screen are same.
First - render is maybe misleading here. You take 7 seconds from starting up to displaying window. After that it refreshes in realtime (30+fps), at least on my Geforce 256. On my system, it is not 7 second, but around 3.5. About 1 second is spent in BranchGroup creation (which is possible to understand, given number of objects there). Around 0.5 in compilation. Another 1s in adding stuff to universe. Around 0.5 in two runs of full gc after that (I suppose that Sphere stuff creates a lot of temporary objects - you might want to use on of j3d.org spheres to reduce usage). And then another 0.5 second to get window to appear (OS stuff I suppose, plus some class loading). There is no clear slowdown here. You could optimize some parts and gain maybe 10-50%, but you will not go under certain time - awt,opengl and java3d take some time to initialize. After first initialization, rendering is real time. With 5000 spheres, entire init took 10s. Part of problem is live memory - 5000 shapes, transform groups etc have to be set up, transformed etc, but this is clear. But when looking at traces I stumbled at something really worrying: percent live alloc'ed stack class rank self accum bytes objs bytes objs trace name 94 0.11% 87.51% 20016 1 50080000 5000 10593 javax.media.j3d.CachedTargets 95 0.11% 87.62% 20016 1 50079984 4999 10601 <Unknown_class> 96 0.11% 87.73% 20016 1 50079984 4999 10600 javax.media.j3d.HashKey 97 0.11% 87.85% 20016 1 50079984 4999 10602 javax.media.j3d.CachedTargets 98 0.11% 87.96% 20016 1 50079984 4999 10599 <Unknown_class> Problem is not amount of live data, but amount of data which got allocated and collected. 50MB !!! for each trace. This gives 250MB of garbage to be collected. But looking at verbose gc output, about 2-4s of these 10s where spend in gc. This is much. But something looks wrong here - is it possible for non-array object to take up 10-20k ? Anyway, output from verbose gc confirms that there is 200+MB of garbage collected, with about 20MB of live data staying. All traces point around javax.media.j3d.SharedGroupRetained.setNodeData(SharedGroupRetained.java:167) javax.media.j3d.NodeRetained.doSetLive(NodeRetained.java:621) javax.media.j3d.GroupRetained.doSetLive(GroupRetained.java:2101) javax.media.j3d.GroupRetained.setLive(GroupRetained.java:2075) javax.media.j3d.SharedGroupRetained.setLive(SharedGroupRetained.java:296) javax.media.j3d.LinkRetained.setLive(LinkRetained.java:159) javax.media.j3d.GroupRetained.childDoSetLive(GroupRetained.java:2083) javax.media.j3d.GroupRetained.doSetLive(GroupRetained.java:2132) javax.media.j3d.TransformGroupRetained.setLive(TransformGroupRetained.java:543) javax.media.j3d.GroupRetained.childDoSetLive(GroupRetained.java:2083) javax.media.j3d.GroupRetained.doSetLive(GroupRetained.java:2132) javax.media.j3d.TransformGroupRetained.setLive(TransformGroupRetained.java:543) javax.media.j3d.GroupRetained.childDoSetLive(GroupRetained.java:2083) javax.media.j3d.GroupRetained.doSetLive(GroupRetained.java:2132) javax.media.j3d.BranchGroupRetained.setLive(BranchGroupRetained.java:161) javax.media.j3d.Locale.doAddBranchGraph(Locale.java:206) javax.media.j3d.Locale.addBranchGraph(Locale.java:163) com.sun.j3d.utils.universe.SimpleUniverse.addBranchGraph(SimpleUniverse.java:356) TestApp.<init>(TestApp.java:86) TestApp.main(TestApp.java:121) Is this normal ? Artur =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".