Logo by AGUS - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Follow us on Twitter
 
*
Welcome, Guest. Please login or register. September 21, 2018, 06:41:52 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Tips on speeding up Scratch-based fractal programs?  (Read 532 times)
0 Members and 1 Guest are viewing this topic.
greentexas
Navigator
*****
Posts: 64


« on: November 20, 2016, 07:15:43 PM »

I am working on a program that plots fractals on Scratch. It is called Dinkydau (a reference to the YouTube user of the same name) and has many features. It is awfully slow unless you are using http://phosphorus.github.io/ to run it. Even then, it is much slower than programs like Fractal Extreme and Ultra Fractal.

Any tips on speeding up a fractal program for you Scratch users out there?
Logged
Fracticality
Forums Newbie
*
Posts: 2


« Reply #1 on: April 05, 2017, 04:08:06 PM »

I can tell you what I know from my own experience. cheesy Firstly, I work in Python, which is probably not recommended by anyone for a fractal program. So maybe you won't find my advice very relevant.

I started my fractal program by iterating the pixels one by one. I can't imagine a slower method. I had to print the progress as it was working just so I could know it was working. I sped it up first by using multithreading, so multiple processor cores could handle the load. An easy way is to divide the image into quadrants or something similar. A better way is to divide the pixels directly. With N threads, every thread (from 1 to N) computed only the pixels where the pixel number % N == thread number (aka, divide pixel number by number of threads and compute where the remainder equals the thread number). This divides the pixels as evenly as possible. This gave me speedups of up to 4x faster than the original method.

I abandoned the project for a few months after this. In that time, I learned from tinkering with neural networks how fast data can be handled in matrices (or arrays, with the numpy library in Python) compared to otherwise. Since then I have converted my fractal program back to single thread processing and now I calculate everything in matrices. Computation is 3x faster on a single thread than it ever was using multiple cores. And this is where I'm at now. I'm guessing the road ahead will have me learning how to do my matrix calculations on a GPU (when I get a new PC).

I know there's always the possibility of simplifying the math to make computations go faster, but my program takes a manual entry formula, (for example if I wanted to iterate Z^3 -1/Z + C^2) and I can't even imagine how to write code that can simplify arbitrary formulas on the fly.

Wait for more replies though. I tend to do things the hard way.
Logged
rethread
Forums Freshman
**
Posts: 11


« Reply #2 on: July 14, 2017, 03:30:38 PM »

Gpus pack a giant bus if you want to go put your procedural generation code in shaders, but it only goes full speed if you keep your texture reads nice and small and repetitive.
Im not a big optimizer, i code the laziest stuff before i run it on the video card,  it goes pretty good, but if u had a decent optimization/simplification it would run faster on the faster. Thats tend to be my pattern of development,  aligning stuff to run on matrices sounds like something id try to do as well,  no maths simplification just trying to blockize the compute instead,  and just keeping the lazy....
Logged
tsl
Forums Newbie
*
Posts: 5


« Reply #3 on: August 06, 2017, 08:25:16 PM »

Scratch will always be slow, it's interpreted language. 3 years ago I've made fractal flames explorer. It was my biggest Scratch (partly generated from Groovy scripts) project and I'm really happy with the result. In turbo mode it's fast enough for me. Check out: https://scratch.mit.edu/projects/17114670/
Phosphorus differently renders points and visually it's worse.
Give link to your sketch I can try to see if anything can be optimized.
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Fractal Programs Meet & Greet Captain Jack 1 1077 Last post March 22, 2008, 09:35:01 AM
by Sockratease
Linux Fractal Programs Discuss Fractal Forums jwm-art 1 1164 Last post November 14, 2010, 09:45:42 PM
by jwm-art
About PC fractal programs on the Mac Help & Support othereyes111 2 352 Last post March 31, 2013, 03:11:25 AM
by toxic-dwarf
3D fractal programs and obj export 3D Fractal Generation Natan Sharp 2 2417 Last post September 03, 2015, 10:55:57 AM
by Sockratease
Create a 3D fractal generator program from scratch, what will it take? Programming ac4937 2 371 Last post March 05, 2017, 12:02:39 AM
by DarkBeam

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.169 seconds with 27 queries. (Pretty URLs adds 0.011s, 2q)