VBA Benchmark – Performance Improvement of Compiled VBA vs Original VBA
Besides the strongest Excel VBA protection, the DoneEx VbaCompiler for Excel can improve VBA performance after compilation.
Below you will find the benchmarking results of real algorithms. The comparison was made between the speed of calculation of original VBA code versus the calculation speed of VBA code compiled into a DLL file by the use of DoneEx VbaCompiler for Excel.
Each workbook example with the original VBA code may be downloaded by the use of the link present after the benchmark description. This way you can make these speed measurements and comparisons on your end so that you can confirm the results for yourself.
In different environments the absolute values of the calculation times may be different but the relation between the calculation speed of the original VBA code and the compiled VBA code will be approximately the same.
Tests were made in the following environment: Microsoft Windows 10 Pro, Microsoft Excel from Office 365 32-bit v1912 (Build 12325.20344), DoneEx VbaCompiler for Excel v1.3.2.
All measurements were made through the following steps:
- Test was running on original VBA code. Results are saved in workbook.
- VBA of the original example workbook with the saved result of testing is compiled by VbaCompiler for Excel with the C-language optimization option set to the “O3” value.
- Run test in compiled workbook. Results of the calculation speed comparison are shown in the following images.
Quasi-Random Monte Carlo Simulation of Black-Scholes for 1,000,000 (1 million) simulations
Black-Scholes algorithm is used in finance to calculate the theoretical value of options using current stock prices, expected dividends, the option’s strike price, expected interest rates, time to expiration and expected volatility. After compilation with VbaCompiler for Excel the benchmark shows x2.7 VBA performance improvement. The workbook example you may download from our website.
Quasi – Monte Carlo – One Simulation
Quasi – Monte Carlo one simulation. After compilation with VbaCompiler for Excel the benchmark shows x3 VBA performance improvement. The workbook example you may download from our website.
MD5 – Message Digest algorithm VBA benchmark
MD5 algorithm is fast and in order to increase the total time of calculation and make it more measurable the MD5 calculation was repeated 1000 times.
MD5 algorithm benchmark shows an increase in speed of the VBA code resulting in it being 4 times (x4) faster after compilation with VbaCompiler. You may download the MD5 workbook example.
Quick Sorting of Double array with 10,000,000 items
As you can see from the chart – the VBA code compiled with DoneEx VbaCompiler for Excel has a times 3 (x3) VBA performance improvement. The Quick Sort example may be downloaded from our website.
Base64 -binary-to-text encoding algorithm VBA benchmark
There are 2 different algorithms of Base64 that are used for benchmarks, each with a different performance. To distinguish between them, one of them is named Radix64. Both algorithms are repeated in the test 10,000 times to allow for a reasonable time measurement.
Radix64 receives a VBA speed increase of 2 times (2x) after the VBA code compilation.
Fast Base64 algorithm acquires a VBA performance improvement after compilation with VBA compiler of about 1.2 times (x1.2) the original speed.
The Base64 workbook example, which contains both algorithms, may be downloaded from our website