New Benchmark Tests For Variadic Template and Initializer List Versions of min

A correction of the results of N2722 and N2772

Author: Niels Dekker
Date: March 11, 2010

In February 2010, new benchmarks for variadic template and initializer list versions of min were done, which were intended to provide background information to LWG issue #1308. Concerns about initializer_list overloads of min, max, and minmax. Unfortunately, I was not able to finalize a new benchmark paper before Pittsburg 2010, and the paper is still under construction. However, the draft version that I presented at c++std-lib-25253 is still available at draft_november_2009.htm Please note that that was a very preliminary draft.

The new benchmark especially targets the graph of Figure 1, which was presented by both N2722 and N2772 (2008). The benchmark done in February 2010 found entirely different results, as shown at Figure 2.

Figure 1 - Mistaken: the min of string graph, presented by both N2772 and N2772 (2008).
Figure 1 – Mistaken: the min of string graph, presented
 by both N2772 and N2772 (2008)



Figure 2 (below here) - min of minimal_string, a new benchmark result (February 2010) for 1 to 24 arguments.
Figure 2 – min of minimal_string, a new benchmark result (February 2010) for 1 to 24 arguments

In the case of min of minimal_string, the variadic template appears significantly faster than the initializer_list version.

minimal_string is a very simple container of characters, which does not do reference counting. (GCC's current std::string implementation still does.) Its source code is at source/2010/benchmark_headers/minimal_string.h

Please contact me if you would like to have more information about the benchmark.


Niels Dekker, March 11, 2010