in reply to The horribly slow Julia set viewer with the extremely inefficient plotting method

This seems to be very slow

...yeah...you are pushing the calculation limits of perl by doing 500 updates on the slightest mouse motion....this app seems simple enough.....you have the prototype in Perl....now convert it to c for speed..... the gtk+ c tutorial is not too hard.

...if you want to keep Perl, but speed it up, ...... stop updating ALL rectangles everytime... blank it out, and as you fill in color, at 100 rectangles at a time, leave them set ..... so you can minimize the number being dynamically changed from 500 down to 100 or even 50

.... if i were doing it, i would shove the 500 initial rectangles into an array, and loop thru them, say 50 or 100 at a time, and see the effect..... a big circular array of rects


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku
  • Comment on Re: The horribly slow Julia set viewer with the extremely inefficient plotting method

Replies are listed 'Best First'.
Re^2: The horribly slow Julia set viewer with the extremely inefficient plotting method
by kikuchiyo (Hermit) on Dec 17, 2009 at 15:11 UTC
    Oh, no need to be so serious about it. I wrote this for fun. Streching the limits of perl (or Goo::Canvas specifically) was the point.
    In fact, the slowness is caused by the fact that I create 360×300 = 10800 rectangle objects, and every time the mouse moves, all of them gets updated. I wrote a modified version that uses C for the Julia iteration:
    Profiling this shows that the julia_iter function (that calculates the new color) needs 3 us while the set method for the rectangles takes 12 us.
      To illustrate the point, here is a version that does not use Goo::Canvas and rectangles at all, it builds up a string of rgb pixels instead and uses that to create a pixbuf, which in turn gets displayed on a DrawingArea.

      This is actually fast enough to be usable, as the animation is quite smooth on my machine.

        To illustrate the point

        .....now you're taiking..... nice example


        I'm not really a human, but I play one on earth.
        Old Perl Programmer Haiku