X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=check%2Ftimes.cpp;h=4ba2ca33902bf70760bac6a35060ac7a21269f9f;hb=e8099a0ac2352ff958142455048ef872a1d97852;hp=246a51235649053b9279b6c1e983ba36b304b145;hpb=dad107ff48f68d45e72469a8716df375ae145cf3;p=ginac.git diff --git a/check/times.cpp b/check/times.cpp index 246a5123..4ba2ca33 100644 --- a/check/times.cpp +++ b/check/times.cpp @@ -3,7 +3,7 @@ * Main program that calls the individual timings. */ /* - * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2004 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,167 +21,71 @@ */ #include -#include - #include "times.h" +/** Generate a random amount of symbols and destroy them again immediatly. + * This operation effectively makes the serial numbers of all subsequent + * symbols unpredictable. If the serials are unpredictable, then so are + * their hash values. If the hash values are unpredictable, then so are + * the canonical orderings. If the canonical orderings are unpredictable, + * all subsequent times are subject to some variation. This variation, + * however is natural and desireable for two reasons: First, we cannot know + * how many symbols have been generated before in real world computations. + * Second, the following timings are subject to some semi-random variation + * anyways because short timings need to be repeated until enough time has + * gone by for the measurement to be reliable. During this process the serial + * numbers will be shifted anyways in a semi-random way. It is better not + * to lull the user in a false sense of reproducibility and instead confront + * her with the normal variation to be expected. + */ +void randomify_symbol_serials() +{ + srand((unsigned)time(NULL)); + const int m = rand() % 666; + for (int s=0; s