In examining a Mandelbrot Fractal viz created by Zen Master Noah Salvaterra, we found that the visualization is slow. Yes, it involves quite a bit of calculations. By applying simple optimizing techniques, we can accelerate the calculations significantly. By evaluating our optimized viz against Noah's viz on Tableau desktop 10.5, we achieved 250% to 300% accelerations.

How? Initially, I tried to minimize where ever possible the calculations such as the following.

1.Computation of r (calculation per every data mark)
  • float(mid([u],1,find([u],",")-1))^2+float(mid([u],find([u],",")+1))^2
We suspect that find([u],",") may have been computed twice (depending on Tableau's compiler!). Anyway, we compute it once and create a new field called [Position,]. We get:
  • float(mid([u],1,[Position,]-1))^2+float(mid([u],[Position,]+1))^2
2.Computation of x  (calculation per every x index)
  • ([Zoom]/2)*(index()-[points]-1)/([points])+[x0]
All blue variables are parameters. Just by combining them and calculating in advance, we get this formula:
  • [Zoom/(2*points)]*index()+[x00]
where [Zoom/(2*points)] and [x00] are two new columns hosting those precalculations. Saved some multiplications and divisions into only 1 multiplication and 1 addition.

Same has been applied to the calculation of y.

3.Computation of the state variable u (computation at every data mark)
Note that the str([x])+","+str([y]) is a common term. We created a new field
  • [IniString]=str([x])+","+str([y])
The resulting formula for u became:
The new viz can be found here.

For a couple of cases, the stats on running on Tableau Desktop 10.5.0 we got are as follows:
- 51x51 grid and 20 iterations: the consumed time improved from 24s to 8s. That's 3 to 1.
- 101x101 grid and 20 iterations: the improvement is from 96s to 33s. That's 2.9 to 1.

So we achieved about 3 times faster.

Later on, we examined the contribution of each of the 3 optimizations, the last one did the most. The other 2's contributions are negligible.

Conclusion
Performance of a viz has been a concern. The cause can be multiple. Here we just address the calculations. There are two categories of calculations we need to be wary of:
- Calculation per row of data
- Calculation per data mark

Think that if we have 1 millions of data marks or rows, one operation/row saved would 1 million operations saved for the viz. This can accelerate the rendering and make user experience a much better one. Or it allows us to visualize more data in the equivalent amount of time.
0

Add a comment

Blog Archive
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.