VBA Benchmark – Performance Improvement of Compiled VBA vs Original VBA
VBA benchmarks show that not only is DoneEx VbaCompiler for Excel the strongest Excel VBA protection, it can also improve VBA performance after compilation.
Below you will find the benchmarking results of real algorithms. The comparison is between the speed of the calculation of the original VBA code as well as the calculation speed of the VBA code compiled into a DLL file using DoneEx VbaCompiler for Excel.
You can download each workbook example with the original VBA code using the link present after the benchmark description. This way you can make these speed measurements as well as the 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 followed these steps:
- At first, the test runs on original VBA code. The results are then saved in a workbook.
- Following that, the 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.
- Finally, the test is ran using the compiled workbook. The following images display the results of the calculation speed comparison.
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 compiled VBA code is just significantly faster. The workbook example you may download from our website.
MD5 – Message Digest algorithm VBA benchmarks
MD5 algorithm is fast. In order to increase the total time of calculation and make it more measurable the MD5 calculation repeats 1000 times.
VBA benchmarks show an increase in speed of the MD5 algorithm VBA code resulting in it being 4 times (x4) faster after compilation with VbaCompiler. Undeniably a massive performance improvement! 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. Undoubtedly a massive performance improvement! You can download the Quick Sort example from our website.
Base64 -binary-to-text encoding algorithm VBA benchmarks
Finally, there are 2 different Base64 algorithms we can use for VBA benchmarks. Each one has a different performance. To distinguish between them by name, let’s call one of them Radix64. Both algorithms repeat in the test 10,000 times. This is to allow for a reasonable time measurement.
Radix64 VBA Benchmarks show 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.
You can download the Base64 workbook example, which contains both algorithms, from our website.