ILNumerics - Technical Computing Tools

High Performance Framework for Visualization

and Computing in Industry and Science


C vers. ILNumerics Performance Comparison

This example implements a simple sum(A + B) over two large matrices A and B - as plain C version and in ILNumerics. In C the matrices are handled as 1D arrays. The .NET version utilized ILNumerics.Array instead. Besides the much easier implementation in ILNumerics, the automatic parallelization beats the C version for most data sizes.

Make sure to compile the C version first. The result 'CPP Version.exe' is automatically copied into the output directory of the 'ILNumerics Version' project. Make sure to compile both projects in Release mode, applying all useful compiler optimizations.

The default configuration creates matrices of size [4000, 4000]. It is recommended to run the example as a 64 bit process.

The faster execution speed is achieved by the ILNumerics version due to automatic parallelization and by the fact, that the iteration of the matrices (and of all n-dimensional arrays) happens in a way which takes cache performance into account.

In order to make a fair comparison the C version walks along a cache optimized path, too. (This is something a C programmer otherwise would have to pay attention to explicitly.) Thus, the performance difference comes mainly from the parallelization performed by the ILNumerics version.

The execution time is measured by running the sum() operation in a loop with 100 iterations, leaving the first iteration out of the measurement. Note, that the influence of the memory allocations and array initializations are considered in each iteration, too.

Last modified: October 15 2018 14:00

Download ZIP


All Examples