[visionegg] Re: smooth object motion

  • From: Simeon Fitch <metasim@xxxxxxxxx>
  • To: visionegg@xxxxxxxxxxxxx
  • Date: Wed, 24 Aug 2005 12:18:30 -0400

Gabriel,

How complicated are your objects, in terms of vertices/polygons? If
each drawing routine is making a lot of GL calls (which are quite
expensive, probably more so than the interpreter loop), you could
reduce the number of those calls with display lists and/or vertex
arrays.

Have you tried running to code in the profiler to figure out exactly
where you bottle neck is? (See
http://docs.python.org/lib/profile.html) Your experience may be
different, but every time I try to guess what is causing my program to
run slowly, I'm wrong! :-)

If you find a fix, I think we'd all be interested in knowing what the
problem was and your fix for it.

Best,

Simeon



On 8/23/05, Gabriel Nevarez <nevarezg@xxxxxxxxxxxxx> wrote:
> Hello, all,
> 
> I was hoping to recode some multiple-object-tracking studies in VisionEgg.  
> So,
> thinking that it'd be nice that I finally get to do an object-oriented version
> of an object-tracking program, I go about it, only to realize that the
> interpreter overhead makes the final program too slow to be useful.
> 
> Essentially, I create anywhere from 1 to 10 objects, giving them individual
> properties (i.e, size, shape, position, orientation, etc) and append them in a
> list, then I iterate through their trajectories, themselves part of the 
> object,
> (generated offline and loaded before each trial) for each object, as such:
> 
>      g_num_objects = 8
>      g_num_cycles = 1000
> 
>     ## in main experiment loop ##
>     for j in xrange (g_num_cycles):
>         for i in xrange(g_num_objects):
>             object_list[i].position = object_list[i].trajectory_list[j]
>             drawScreen()
> 
> It works exactly as intended.... but *horribly* slow!
> 
> Any suggestions on optimizing overall script speed?  Have looked into the
> generally-recommended performance-enhancing python tips (such as
> http://www.szgti.bmf.hu/harp/python/fastpython.html), but seems the main speed
> bottleneck is the interpreter moving up and down the call stack within the
> embedded loops, so I would need to restructure the object position updates in 
> a
> different way from the embedded loops I currently have.  I noticed the Dots.py
> demo uses the Numeric package to optimize object movement, which I'm currently
> looking into.
> 
> Any tips?
> 
> cheers,
> 
> -=Gabriel Nevarez
> Research Programmer
> Psychology Department
> Cardiff University
> http://www.cf.ac.uk/psych
> 
> ======================================
> The Vision Egg mailing list
> Archives: //www.freelists.org/archives/visionegg
> Website: http://www.visionegg.org/mailinglist.html
> 


-- 
Simeon H.K. Fitch, Owner
Mustard Seed Software
http://www.mseedsoft.com/
=====================================The Vision Egg mailing list
Archives: //www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html

Other related posts: