From f6cbce233ef89c30bbc8334c800e8a205677ec8b Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sat, 26 Aug 2017 10:04:43 +0200 Subject: Reduce the running times of the tests in test/c Running times were too long when executed on low-end ARM or PowerPC hardware, or under QEMU emulation. --- test/c/Results/binarytrees | 16 +++++------- test/c/Results/chomp | 16 +++++------- test/c/Results/fannkuch | 62 ++++++++++++++++++++++----------------------- test/c/Results/fib | 2 +- test/c/Results/mandelbrot | Bin 1125013 -> 125013 bytes test/c/Results/nbody | 2 +- test/c/Results/perlin | 2 +- test/c/Results/spectral | 2 +- test/c/aes.c | 2 +- test/c/binarytrees.c | 2 +- test/c/bisect.c | 2 +- test/c/chomp.c | 4 --- test/c/fannkuch.c | 2 +- test/c/fft.c | 2 +- test/c/fftsp.c | 2 +- test/c/fftw.c | 2 +- test/c/fib.c | 2 +- test/c/knucleotide.c | 2 +- test/c/lists.c | 2 +- test/c/mandelbrot.c | 2 +- test/c/nbody.c | 2 +- test/c/nsieve.c | 2 +- test/c/nsievebits.c | 2 +- test/c/perlin.c | 14 +++++----- test/c/qsort.c | 2 +- test/c/sha1.c | 2 +- test/c/sha3.c | 2 +- test/c/siphash24.c | 2 +- test/c/spectral.c | 2 +- test/c/vmach.c | 4 --- 30 files changed, 75 insertions(+), 87 deletions(-) diff --git a/test/c/Results/binarytrees b/test/c/Results/binarytrees index 696bd5c8..9dfe1355 100644 --- a/test/c/Results/binarytrees +++ b/test/c/Results/binarytrees @@ -1,9 +1,7 @@ -stretch tree of depth 17 check: -1 -131072 trees of depth 4 check: -131072 -32768 trees of depth 6 check: -32768 -8192 trees of depth 8 check: -8192 -2048 trees of depth 10 check: -2048 -512 trees of depth 12 check: -512 -128 trees of depth 14 check: -128 -32 trees of depth 16 check: -32 -long lived tree of depth 16 check: -1 +stretch tree of depth 13 check: -1 +8192 trees of depth 4 check: -8192 +2048 trees of depth 6 check: -2048 +512 trees of depth 8 check: -512 +128 trees of depth 10 check: -128 +32 trees of depth 12 check: -32 +long lived tree of depth 12 check: -1 diff --git a/test/c/Results/chomp b/test/c/Results/chomp index c2154208..145b603a 100644 --- a/test/c/Results/chomp +++ b/test/c/Results/chomp @@ -1,18 +1,14 @@ -player 0 plays at (2,2) -player 1 plays at (7,1) -player 0 plays at (0,2) -player 1 plays at (7,0) -player 0 plays at (6,1) +player 0 plays at (1,1) player 1 plays at (6,0) -player 0 plays at (5,1) +player 0 plays at (0,6) player 1 plays at (5,0) -player 0 plays at (4,1) +player 0 plays at (0,5) player 1 plays at (4,0) -player 0 plays at (3,1) +player 0 plays at (0,4) player 1 plays at (3,0) -player 0 plays at (2,1) +player 0 plays at (0,3) player 1 plays at (2,0) -player 0 plays at (1,1) +player 0 plays at (0,2) player 1 plays at (1,0) player 0 plays at (0,1) player 1 plays at (0,0) diff --git a/test/c/Results/fannkuch b/test/c/Results/fannkuch index 15d56d61..be1815d4 100644 --- a/test/c/Results/fannkuch +++ b/test/c/Results/fannkuch @@ -1,31 +1,31 @@ -1234567891011 -2134567891011 -2314567891011 -3214567891011 -3124567891011 -1324567891011 -2341567891011 -3241567891011 -3421567891011 -4321567891011 -4231567891011 -2431567891011 -3412567891011 -4312567891011 -4132567891011 -1432567891011 -1342567891011 -3142567891011 -4123567891011 -1423567891011 -1243567891011 -2143567891011 -2413567891011 -4213567891011 -2345167891011 -3245167891011 -3425167891011 -4325167891011 -4235167891011 -2435167891011 -Pfannkuchen(11) = 51 +12345678910 +21345678910 +23145678910 +32145678910 +31245678910 +13245678910 +23415678910 +32415678910 +34215678910 +43215678910 +42315678910 +24315678910 +34125678910 +43125678910 +41325678910 +14325678910 +13425678910 +31425678910 +41235678910 +14235678910 +12435678910 +21435678910 +24135678910 +42135678910 +23451678910 +32451678910 +34251678910 +43251678910 +42351678910 +24351678910 +Pfannkuchen(10) = 38 diff --git a/test/c/Results/fib b/test/c/Results/fib index 53a71233..84ce6474 100644 --- a/test/c/Results/fib +++ b/test/c/Results/fib @@ -1 +1 @@ -fib(40) = 165580141 +fib(35) = 14930352 diff --git a/test/c/Results/mandelbrot b/test/c/Results/mandelbrot index 2e350cf0..b81e96bf 100644 Binary files a/test/c/Results/mandelbrot and b/test/c/Results/mandelbrot differ diff --git a/test/c/Results/nbody b/test/c/Results/nbody index d132576b..41b648fd 100644 --- a/test/c/Results/nbody +++ b/test/c/Results/nbody @@ -1,2 +1,2 @@ -0.169075164 --0.169031665 +-0.169086185 diff --git a/test/c/Results/perlin b/test/c/Results/perlin index 74e56554..4503fc1c 100644 --- a/test/c/Results/perlin +++ b/test/c/Results/perlin @@ -1 +1 @@ -1.7556e+02 +-4.0543e+03 diff --git a/test/c/Results/spectral b/test/c/Results/spectral index 50f033a0..1e35f7e0 100644 --- a/test/c/Results/spectral +++ b/test/c/Results/spectral @@ -1 +1 @@ -1.274224153 +1.274224148 diff --git a/test/c/aes.c b/test/c/aes.c index 5bd57cbc..0aa02595 100644 --- a/test/c/aes.c +++ b/test/c/aes.c @@ -1449,6 +1449,6 @@ int main(int argc, char ** argv) (u8 *)"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF", (u8 *)"\x8E\xA2\xB7\xCA\x51\x67\x45\xBF\xEA\xFC\x49\x90\x4B\x49\x60\x89", 5, 6); - do_bench(10000000); + do_bench(1000000); return 0; } diff --git a/test/c/binarytrees.c b/test/c/binarytrees.c index 31cf3122..b4b10232 100644 --- a/test/c/binarytrees.c +++ b/test/c/binarytrees.c @@ -73,7 +73,7 @@ int main(int argc, char* argv[]) unsigned N, depth, minDepth, maxDepth, stretchDepth; treeNode *stretchTree, *longLivedTree, *tempTree; - N = argc < 2 ? 16 : atol(argv[1]); + N = argc < 2 ? 12 : atol(argv[1]); minDepth = 4; diff --git a/test/c/bisect.c b/test/c/bisect.c index 14d06245..8e3c567b 100644 --- a/test/c/bisect.c +++ b/test/c/bisect.c @@ -344,7 +344,7 @@ int main(int argc,char *argv[]) double eps,eps2; double *D,*E,*beta,*S; - rep = 50; + rep = 1; n = 500; eps = 2.2204460492503131E-16; diff --git a/test/c/chomp.c b/test/c/chomp.c index 7c8e6110..c88cef5c 100644 --- a/test/c/chomp.c +++ b/test/c/chomp.c @@ -339,11 +339,7 @@ int main(void) ncol = 7; -#ifdef SMALL_PROBLEM_SIZE nrow = 7; -#else - nrow = 8; -#endif tree = make_play(1); /* create entire tree structure, not just the */ player = 0; /* needed part for first move */ current = make_data(nrow,ncol); /* start play at full board */ diff --git a/test/c/fannkuch.c b/test/c/fannkuch.c index 7feaf6d7..9cc7a693 100644 --- a/test/c/fannkuch.c +++ b/test/c/fannkuch.c @@ -98,7 +98,7 @@ fannkuch( int n ) int main( int argc, char* argv[] ) { - int n = (argc>1) ? atoi(argv[1]) : 11; + int n = (argc>1) ? atoi(argv[1]) : 10; printf("Pfannkuchen(%d) = %ld\n", n, fannkuch(n)); return 0; diff --git a/test/c/fft.c b/test/c/fft.c index a4755044..2bd55a18 100644 --- a/test/c/fft.c +++ b/test/c/fft.c @@ -143,7 +143,7 @@ int dfft(double x[], double y[], int np) /* Test harness */ -#define NRUNS 20 +#define NRUNS 2 int main(int argc, char ** argv) { diff --git a/test/c/fftsp.c b/test/c/fftsp.c index f83bd41f..26b18b62 100644 --- a/test/c/fftsp.c +++ b/test/c/fftsp.c @@ -145,7 +145,7 @@ int dfft(float x[], float y[], int np) /* Test harness */ -#define NRUNS 3000 +#define NRUNS 300 int main(int argc, char ** argv) { diff --git a/test/c/fftw.c b/test/c/fftw.c index 40648257..913091d9 100644 --- a/test/c/fftw.c +++ b/test/c/fftw.c @@ -74,7 +74,7 @@ const E KP1_847759065 = ((E) +1.847759065022573512256366378793576573644833252); /* Test harness */ -#define NRUNS (1024 * 1024) +#define NRUNS (100 * 1000) int main() { diff --git a/test/c/fib.c b/test/c/fib.c index 23460a1d..e4c7d095 100644 --- a/test/c/fib.c +++ b/test/c/fib.c @@ -12,7 +12,7 @@ int fib(int n) int main(int argc, char ** argv) { int n, r; - if (argc >= 2) n = atoi(argv[1]); else n = 40; + if (argc >= 2) n = atoi(argv[1]); else n = 35; r = fib(n); printf("fib(%d) = %d\n", n, r); return 0; diff --git a/test/c/knucleotide.c b/test/c/knucleotide.c index ef909e0e..3ac469be 100644 --- a/test/c/knucleotide.c +++ b/test/c/knucleotide.c @@ -281,7 +281,7 @@ write_count (char *searchFor, char *buffer, long buflen) ht_destroy (ht); } -#define NRUNS 500 +#define NRUNS 50 int main () diff --git a/test/c/lists.c b/test/c/lists.c index fc974539..ced384c0 100644 --- a/test/c/lists.c +++ b/test/c/lists.c @@ -59,7 +59,7 @@ int main(int argc, char ** argv) struct list * l; if (argc >= 2) n = atoi(argv[1]); else n = 1000; - if (argc >= 3) niter = atoi(argv[1]); else niter = 200000; + if (argc >= 3) niter = atoi(argv[1]); else niter = 20000; l = buildlist(n); if (checklist(n, reverselist(l))) { printf("OK\n"); diff --git a/test/c/mandelbrot.c b/test/c/mandelbrot.c index 93aa8acb..032e7d75 100644 --- a/test/c/mandelbrot.c +++ b/test/c/mandelbrot.c @@ -22,7 +22,7 @@ int main (int argc, char **argv) double Zr, Zi, Cr, Ci, Tr, Ti; if (argc < 2) { - w = h = 3000; + w = h = 1000; } else { w = h = atoi(argv[1]); } diff --git a/test/c/nbody.c b/test/c/nbody.c index ff3d261d..530c41fa 100644 --- a/test/c/nbody.c +++ b/test/c/nbody.c @@ -140,7 +140,7 @@ void setup_bodies(void) int main(int argc, char ** argv) { - int n = argc < 2 ? 20000000 : atoi(argv[1]); + int n = argc < 2 ? 1000000 : atoi(argv[1]); int i; setup_bodies(); diff --git a/test/c/nsieve.c b/test/c/nsieve.c index 79e95024..819d47f1 100644 --- a/test/c/nsieve.c +++ b/test/c/nsieve.c @@ -26,7 +26,7 @@ static unsigned int nsieve(int m) { return count; } -#define NITER 10 +#define NITER 2 int main(int argc, char * argv[]) { int m = argc < 2 ? 9 : atoi(argv[1]); diff --git a/test/c/nsievebits.c b/test/c/nsievebits.c index ed9cde52..743a5ffd 100644 --- a/test/c/nsievebits.c +++ b/test/c/nsievebits.c @@ -30,7 +30,7 @@ nsieve(unsigned int m) return (count); } -#define NITER 10 +#define NITER 2 static void test(unsigned int n) diff --git a/test/c/perlin.c b/test/c/perlin.c index 6066f85e..e7bbd22d 100644 --- a/test/c/perlin.c +++ b/test/c/perlin.c @@ -21,9 +21,11 @@ static int permutation[256] = { 151,160,137,91,90,15, 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180 }; -static double fade(double t) { return t * t * t * (t * (t * 6 - 15) + 10); } +static inline double fade(double t) +{ return t * t * t * (t * (t * 6 - 15) + 10); } -static double lerp(double t, double a, double b) { return a + t * (b - a); } +static inline double lerp(double t, double a, double b) +{ return a + t * (b - a); } static double grad(int hash, double x, double y, double z) { int h = hash & 15; // CONVERT LO 4 BITS OF HASH CODE @@ -41,7 +43,7 @@ static double noise(double x, double y, double z) { z -= floor(z); double u = fade(x), // COMPUTE FADE CURVES v = fade(y), // FOR EACH OF X,Y,Z. - w = fade(z); + w = fade(z); int A = p[X ]+Y, AA = p[A]+Z, AB = p[A+1]+Z, // HASH COORDINATES OF B = p[X+1]+Y, BA = p[B]+Z, BB = p[B+1]+Z; // THE 8 CUBE CORNERS, @@ -65,9 +67,9 @@ int main(int argc, char ** argv) { init(); double x, y, z, sum = 0.0; - for (x = -11352.57; x < 23561.57; x += .1235) - for (y = -346.1235; y < 124.124; y += 1.4325) - for (z = -156.235; y < 23.2345; y += 2.45) + for (x = -5.0; x < 5.0; x += 0.1) + for (y = -5.0; y < 5.0; y += 0.1) + for (z = -5.0; z < 5.0; z += 0.1) sum += noise(x, y, z); printf("%.4e\n", sum); diff --git a/test/c/qsort.c b/test/c/qsort.c index 50b60be6..66eef68d 100644 --- a/test/c/qsort.c +++ b/test/c/qsort.c @@ -27,7 +27,7 @@ int cmpint(const void * i, const void * j) return 1; } -#define NITER 100 +#define NITER 10 int main(int argc, char ** argv) { diff --git a/test/c/sha1.c b/test/c/sha1.c index 3eab9b3d..0a6ac8fe 100644 --- a/test/c/sha1.c +++ b/test/c/sha1.c @@ -231,6 +231,6 @@ int main(int argc, char ** argv) } do_test(test_input_1, test_output_1); do_test(test_input_2, test_output_2); - do_bench(2000000); + do_bench(200000); return 0; } diff --git a/test/c/sha3.c b/test/c/sha3.c index 93b8ba4a..a0905817 100644 --- a/test/c/sha3.c +++ b/test/c/sha3.c @@ -191,7 +191,7 @@ test_triplet_t testvec[4] = { }; #define DATALEN 100000 -#define NITER 250 +#define NITER 25 int main() { diff --git a/test/c/siphash24.c b/test/c/siphash24.c index 3af4aa04..4a42e013 100644 --- a/test/c/siphash24.c +++ b/test/c/siphash24.c @@ -241,7 +241,7 @@ int speed_test(void) int i; for(i = 0; i < 16; ++i ) k[i] = i; - for(i = 0; i < 10000000; i++) { + for(i = 0; i < 1000000; i++) { testdata[99] = (u8) i; crypto_auth(out, testdata, 100, k); } diff --git a/test/c/spectral.c b/test/c/spectral.c index aa1bf397..f7dc90ee 100644 --- a/test/c/spectral.c +++ b/test/c/spectral.c @@ -43,7 +43,7 @@ void eval_AtA_times_u(int N, const double u[], double AtAu[]) int main(int argc, char *argv[]) { int i; - int N = ((argc == 2) ? atoi(argv[1]) : 2500); + int N = ((argc == 2) ? atoi(argv[1]) : 1000); double * u, * v, vBv, vv; u = malloc(N * sizeof(double)); v = malloc(N * sizeof(double)); diff --git a/test/c/vmach.c b/test/c/vmach.c index 84ab1f94..815cb710 100644 --- a/test/c/vmach.c +++ b/test/c/vmach.c @@ -203,12 +203,8 @@ unsigned int wordcode_tak[] = { int main(int argc, char ** argv) { - int i; - printf("fib(30) = %ld\n", wordcode_interp(wordcode_fib)); printf("tak(18, 12, 6) = %ld\n", wordcode_interp(wordcode_tak)); - for (i = 0; i < 10; i++) (void) wordcode_interp(wordcode_fib); - for (i = 0; i < 500; i++) (void) wordcode_interp(wordcode_tak); return 0; } -- cgit