Re: [Fwd: Re: How badly does my SDLx::App code suck?]

[email protected] (Kartik Thakore)
Newsgroups perl.sdl.devel
Message-ID <1286981716.3156.5.camel@kthakore-laptop>
Hmm, What version of SDL do you have? Also can you come on #sdl
irc.perl.org?

On Wed, 2010-10-13 at 10:53 -0400, Andy Walker wrote:
> For some reason, both of these exit immediately.  Loading it up in
> pdebug, it simply bails out at the first SDL::Video::fill_rect() call
> in draw_frame().
> 
> On Wed, Oct 13, 2010 at 10:14 AM, Kartik Thakore
> <[email protected]> wrote:
> > Apologies I sent the wrong file out.
> > --
> > Kartik Thakore <[email protected]>
> >
> >
> > ---------- Forwarded message ----------
> > From: Kartik Thakore <[email protected]>
> > To: Andy Walker <[email protected]>
> > Date: Wed, 13 Oct 2010 10:05:31 -0400
> > Subject: Re: How badly does my SDLx::App code suck?
> > SDLx::* is still in the stages of being too slow to use. We have not
> > optimized the SDLx::Validate in it.
> >
> > You can mix with SDL::* to improve your performance, if you are
> > confident of the validation.
> >
> > Another things you can do is keep track of what 'LED' changes, and only
> > update that rect.
> >
> > SDL::Video::update_rects( ( SDL::Rect->new(x,y,w,h), .... );
> >
> > I have attached an updated script.
> >
> > Regards,
> > Kartik Thakore
> >
> > On Tue, 2010-10-12 at 10:56 -0400, Andy Walker wrote:
> >> So, my intent here was to simulate the behavior of a planned array of
> >> LED light circuits.  Simply, the idea was that each one would
> >> occasionally randomly decide to change its color to a random RGB
> >> value.  This would then propogate a 'front' of sorts that could
> >> potentially interact with other fronts in strange and interesting
> >> ways.  This basically works.  The problem is that it seems kind of
> >> slow.  This is a result, no doubt of my only burgeoning understanding
> >> of SDL and the Perl bindings.  As you can probably see, it's based off
> >> of the game of life example in that it uses draw_rect to make a grid
> >> of objects across an SDLx::App surface.  Basically it iterates over a
> >> 2D array of datastructures representing each element and renders it.
> >>
> >> Is there a better/faster way to be rendering this?  Should I be
> >> blitting? What aspects could be slowing it down significantly?  A
> >> cursory examination with NYTProf revealed that, unsurprisingly, a lot
> >> of time is being spent in draw_rect, though, interestingly, the
> >> highest amount of time is in its call to
> >> SDLx::Validate::_color_arrayref.  Does this mean using an approach
> >> like this:
> >>
> >> unpack ('I', pack ('C*', int rand...
> >>
> >> to color randomization and comparison would be better, or would
> >> validation still take up a sizable amount of time?
> >>
> >> I'm still learning and trying to piece together the right way to do
> >> things from disparate examples, but it's a little difficult, so I
> >> thought I'd ask here.  Please feel free to comment / criticize at
> >> length.
> >>
> >> -A
> >
> > --
> > Kartik Thakore <[email protected]>
> >
> >

-- 
Kartik Thakore <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.