It might not be in the spirit of *Mathematica* Stack Exchange, but allow me an objection - stuff that is slow in *Mathematica* should be kept out of it. To wit consider how this little C++ nugget does the grunt work:
<!-- language: lang-c++ -->
#include <stdio.h>
#include <cmath>
#include <omp.h>
int main()
{
const int dim = 4096;
const float a = 1.4f, b = -2.3f, c = 2.4f, d = -2.1f;
int size = dim*dim;
float *image = new float[size];
for (int i = 0; i < size; ++i) image[i] = 1;
#pragma omp parallel
{
float x = omp_get_thread_num(), y = 0;
for (int i = 0; i < 10000000; ++i)
{
float xn = sin(a * y) - cos(b * x);
y = sin(c * x) - cos(d * y);
x = xn;
auto xp = ((dim - 1) * (1 + x * 0.43) * 0.5);
auto yp = (int)((dim - 1) * (1 - y * 0.43) * 0.5);
image[(int)((yp * dim + xp))] *= 0.99f;
}
}
FILE *file = fopen("image.bin", "wb");
fwrite(image, sizeof(float), size, file);
fclose(file);
delete[] image;
return 0;
}
This should be compiled with fast math for better performance. I've also included omp in there, because my system has 12 cores and if I don't use them for this - there's no justification for me buying it.
And this *Mathematica* code that makes an image and colorizes it from the produced data:
buffer = BinaryReadList["image.bin", "Real32"];
dim = Sqrt[Length@buffer];
shape = Partition[buffer, dim];
bigimg = Image[shape, "Real32", ImageSize -> {dim, dim}];
pic = Rasterize[bigimg, ImageSize -> dim/4];
cf = ColorData["SunsetColors"];
cpic = Colorize[pic, ColorFunction -> cf]
Note that I'm rendering the original on the 4096x4096 canvas, and then down-sampling it in *Mathematica* - which I find produces a more pleasant aesthetic. This stuff would have taken several days to do proper in C++, and while I'm sure it's possible to write a fast iterator in *Mathematica* - it would probably take a long time as well.
Final image:![Thingy][1]
[1]: https://i.sstatic.net/hHrSO.jpg