SourceForge.net Logo Home

This document defines DAP2 Benchmark's test set.

DAP2 benchmark consists of 7 tests. The idea is to perform the same computation using different abstraction features of a programming language in different combinations.

  • Test 0 - calculate a sum of array filled with 'double' precision floating point numbers. This must be the fastest way to get the sum. You are free to code this in any way. In C++ it would be a simple 'fortran' style loop. In Java it's a little trickier, e.g. HotSpot optimization won't work with that loop. Anyway, the point is to produce the fastest possible code, because all other tests are measured against this one.
  • Test 1 - calculate the sum of array of 'double' objects. This must be an immutable object, not a primitive type. It has to implement the interface IDouble, with an accessor returning a primitive type.
  • Test 2 - calculate the sum of elements of a List, containg the same objects as in Test 1. This List must be from the language's standard collections library, it should provide with a sequential iterator. C# has Collections namespace, Java has Collections framework. I chose ArrayLists for both languages, since they are the fastest Lists.
  • Test 3 - the same as Test 2, but the custom List is used. Moreover, importantly this custom List must be based on the standard abstract/base implementation. Both Java and C# provide us with these base classes, and developers are supposed to use them to build their own custom collections. That's why they are in the benchmark. Also, these custom Lists should be constructed from the Lists instances in Test2.

    Tests 1,2 and 3 accumulate the sum into a primitive variable. However, in the real world, many Java and C# programs (and OOP languages in general) operate with object instances and generate them in large numbers. Particularly, this is applicable for server-side apps. Therefore there are three more tests. They do the same task but they accumulate the sum into a non-primitive variable. So, every time when two instances of double object added to each other using "plus" operator, it produces the new instance of the double object. "Plus" operator is implemented differently in Java and C#. For Java it's an instance of object with "plus" method, for C# it's a delegate. In C++ it would be an overloaded operator.

  • Test 4 - the same as Test1 but with "plus".
  • Test 5 - the same as Test2 but with "plus".
  • Test 6 - the same as Test3 but with "plus".