Computer Science Canada Mandelbrot Set Help |
Author: | DivideByZero [ Fri Oct 30, 2009 9:47 am ] | ||
Post subject: | Mandelbrot Set Help | ||
What is the problem you are having? I need to increase the speed of this program and I have no idea how.... Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using Version 4.1 |
Author: | apomb [ Fri Oct 30, 2009 10:12 am ] |
Post subject: | RE:Mandelbrot Set Help |
write it in another language ![]() |
Author: | DivideByZero [ Fri Oct 30, 2009 11:08 am ] |
Post subject: | Re: RE:Mandelbrot Set Help |
apomb @ Fri Oct 30, 2009 10:12 am wrote: write it in another language
![]() Has to be turing (its for a class) |
Author: | apomb [ Fri Oct 30, 2009 11:26 am ] |
Post subject: | RE:Mandelbrot Set Help |
well, is the assignment to see how efficient you can make it? because if so, it looks like you have it down, the speed is a language-centric problem; Turing just isnt good at doing things like this. but congratulations on making something like this in turing, it is still impressive, no matter how slow it runs. |
Author: | DivideByZero [ Fri Oct 30, 2009 1:23 pm ] | ||
Post subject: | RE:Mandelbrot Set Help | ||
Changed some colours to make it look nicer (havent improved speed at all) |
Author: | Tony [ Fri Oct 30, 2009 2:04 pm ] | ||||||
Post subject: | RE:Mandelbrot Set Help | ||||||
I'm pretty sure that
is equivalent to
You could also set the value of "1 / (maxx / 4) " to a constant, and save yourself 2 divisions per pixel. But those are minor effects. Your Big-O computation is in
If you can skip the entire loop and get the counter value directly from the value of c, then you run much faster. Hint: a pixel next to black (255+) has a high probability of also being black. See if you can reuse any of the results you've already computed. |
Author: | DemonWasp [ Fri Oct 30, 2009 4:52 pm ] |
Post subject: | RE:Mandelbrot Set Help |
Tony: They aren't the same. His will increment counter by k if counter > 255, whereas yours will not. This isn't important in this case since he resets it to 0 at the end of the loop and never accesses the incremented value. |
Author: | Tony [ Fri Oct 30, 2009 10:04 pm ] |
Post subject: | RE:Mandelbrot Set Help |
DemonWasp: but > 255 is inside the "if counter <= 255" statement, thus it will never be true. |
Author: | Zren [ Sat Oct 31, 2009 6:04 pm ] |
Post subject: | RE:Mandelbrot Set Help |
Basic Mathematics c.b += 1 / (maxy / 4) c.b += 4 / maxy You also have a few lines that don't change the variable. |
Author: | DemonWasp [ Mon Nov 02, 2009 1:18 am ] | ||
Post subject: | RE:Mandelbrot Set Help | ||
Tony: Sorry, I mis-typed. I meant it will increment counter by k if counter <= 255 (since counter > 31 or counter < 72 is always true). Correct replacement code would be:
|
Author: | Tony [ Mon Nov 02, 2009 1:39 am ] |
Post subject: | RE:Mandelbrot Set Help |
Oh, I see what you mean. You're right; and also about the fact that it's not necessary to keep the new value since it's reset. |