I have modified the fern input parameters in the spreadsheet presented in the previous post to match the layout used by Barnsley and others, so that examples such as those given at the Wikipedia article can be entered directly. The new file can be downloaded from: Fern chart-Barnsley.zip :
In doing so I also tidied up the VBA matrix multiplication algorithm, and compared it with using the worksheetfunction.MMULT function. The example above is for calculating and plotting 1 million rows, using Excel 2010. It can be seen that:
- The VBA function is about 7 times faster than using the built-in function.
- Transferring the data from VBA to the spreadsheet takes about 50% longer than it does to generate the data.
- Plotting the data remains very slow, taking nearly 90% of the total time. (time for plotting the 1 million point chart was about 10 seconds the first time, and about 20 seconds thereafter. It seems likely there is scope for considerable improvements here in future releases).
Edit 4th Oct 10: I meant to mention that the times recorded here were done on a Dell laptop computer with an Intel P8700 processor (2.53 GHz) and 4 MB RAM, and with a finite element analysis program running in the background, using the full resources of one core virtually all the time. Re-running without any hungry background processes made virtually no difference to the VBA running time (as would be expected since VBA only uses one core), but also made very little difference to the times for the calculation using the MMULT function, or for the re-plotting time. That is surprising since Microsoft say they put a lot of effort into improving the performance of Excel 2010 (compared with 2007). It looks to me like there is plenty of scope for further improvement here.
Times for plotting 40,000 rows are shown below:
The Wikipedia article links to more examples at: http://www.home.aone.net.au/~byzantium/ferns/fractal.html . Some of the different fern varieties reported in that paper have been plotted in the spreadsheet: