48
votes
Increase performance creating Mandelbrot set in python
I'm going to reuse some parts of the answer I recently posted here on Code Review.
Losing your Loops
(Most) loops are damn slow in Python. Especially multiple nested loops.
NumPy can help to ...
27
votes
Accepted
Julia Fractal Drawing in C++
Unqualified names
The namespace identifier is missing from a lot of names - e.g. std::sqrt, std::log, ...
20
votes
Increase performance creating Mandelbrot set in python
This will cover performance, as well as Python style.
Save constants in one place
You currently have the magic numbers 2000 and 3000, the resolution of your image. Save these to variables perhaps ...
18
votes
Accepted
17
votes
Newton Fractal writen in C
Use complex numbers
Since C99, C supports complex numbers, and has many mathematical functions that work on complex numbers. I would rewrite all your code to use ...
15
votes
Accepted
Chaos with Newton’s method
Formatting
Run your code through a style checker / formatter to make it more readable and follow a standardized code style. For example this one
https://codebeautify.org/javaviewer
Don't repeat ...
14
votes
Julia Fractal Drawing in C++
There's already a good answer, so I'm just going to raise a couple of small points.
I had the same thought as Toby Speight about saving the square root of abs(z), ...
14
votes
Increase performance creating Mandelbrot set in python
Don't use vectorized numpy, use numba jit instead
Using numpy to calculate the Mandelbrot set is not really a good fit because the same data will be stored and loaded from and to memory repeatedly, ...
13
votes
Plotting the Mandelbrot set efficiently
Unnecessary use of OpenGL
Using OpenGL to draw individual pixels is the completely wrong thing to do. Apart from requiring OpenGL support which might not be present on all systems, this has a huge ...
12
votes
Increase performance creating Mandelbrot set in python
Mandelbrot-specific optimisations
These can be combined with the Python-specific optimisations from the other answers.
Avoid the redundant square root
...
9
votes
Accepted
Newton Fractal writen in C
I don't like parentheses around expressions returned.
I do not understand init_roots(). Why not just initialise ...
8
votes
Chaos with Newton’s method
I have some suggestions for your code.
As @user985366 also stated in his/her answer, the biggest issue in your code, in my opinion, is the code duplication.
For the colors, the ...
7
votes
OpenGL 3 Mandelbrot Set
This is pretty cool! Several people have posted their Mandelbrot generators here asking for advice on making them faster, and I always recommend that they implement it on the GPU. Glad to see someone ...
7
votes
Accepted
Drawing dragon curves using Turtle graphics
Whitespace
There should be a blank line between two method definitions.
Also, some blank lines inside of the methods would give the code room to breathe, and allow you to visually separate individual &...
7
votes
Plotting the Mandelbrot set efficiently
First impression is that the code is very dense. Reading would be a bit easier if you give the code room to breathe!
Variable names in particular are short and uninformative (why do we have both <...
7
votes
Plotting the Mandelbrot set efficiently
General Observations
I would not want to maintain this code or delegate this code to someone else to maintain.
It is difficult to read and even more difficult to modify.
Before trying to optimize the ...
6
votes
Mandelbrot Fractal Drawer in C++
I see a number of things that may help you improve your code.
Fix the bugs
There are a couple of bugs in this program that should be fixed. First, the include guard in ...
6
votes
Accepted
Generating Julia set
1. Review
Some of the variable names could be improved:
complex_plane is an array of \$z\$ values for each pixel in the image, so naming it ...
6
votes
Accepted
Sierpiński's carpet fractal animation for teaching Python 3
Algorithm
You can simplify the code and make it run faster if you construct the next-level carpet by continuing to work on the previous image (punching more holes in it), rather than starting with a ...
6
votes
Increase performance creating Mandelbrot set in python
I'm not a python expert. I am pretty good with Mandlebrot generation (I've spent a lot of time on my custom Julia Set generator.)
So I'll say this: optimize the heck out of stuff that will be ...
6
votes
Accepted
Mandelbrot Set image generator in Rust
Couple of things I noticed:
infinity_limit is constant for a given call to draw_area. Its only use is in ...
5
votes
Accepted
Mandelbrot Fractal Drawer in C++
This is a lot of code to cover, so I'll touch on the highlights. Overall the code is pretty straightforward and easy to read. I like that you used std::complex ...
5
votes
Chaos with Newton’s method
I hope you don't mind that I mostly copy&pasted my last answer to one of your questions, but basically, the points are mostly still the same.
Whitespace
There should be a blank line between two ...
5
votes
5
votes
Plotting the Mandelbrot set efficiently
Since you want to do this efficiently - measure how long each OpenGL call takes. I wouldn't be surprised at all if that takes most of the time. Find out how to store various pixel values int a buffer ...
4
votes
Optimizing rendering with a lot of transformations and save/restore
I see this was the second javascript question you posted here and it is unfortunate that there have been no responses in the nearly four years since then. Perhaps you have learned a few things about ...
4
votes
Accepted
Drawing fractals with Turtle
Couple performance and code style related notes:
if you can define something outside/before a loop, do so. For example, there is no need to define linSys inside ...
4
votes
Drawing fractals with Turtle
For each shape, you have this kind of code to generate the movement "recipe":
...
4
votes
Interactive Mandelbrot Set generator
private Color[] colorSet;
in public class ImageSlicePainter is an instance property, and the
(256) colors are computed each ...
4
votes
Sierpiński's carpet fractal animation for teaching Python 3
I only have a few small suggestions:
I like to have "tweaks" that I may want to change later at the top of my file. This makes it easier to quickly alter them when playing around without needing to ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
fractals × 86python × 24
performance × 24
java × 13
beginner × 13
python-3.x × 11
graphics × 11
c++ × 9
image × 9
ascii-art × 8
c# × 6
turtle-graphics × 6
javascript × 5
c × 5
multithreading × 5
numpy × 5
rust × 5
animation × 4
canvas × 4
object-oriented × 3
recursion × 3
mathematics × 3
swing × 3
f# × 3
matlab × 3