comparison test/test_benchmark.h @ 41:c6e0df09b86f default tip

*: performance improvements with old GCC, reimplement altivec
author Paper <paper@tflc.us>
date Mon, 28 Apr 2025 16:31:59 -0400
parents f9ca85d2f14c
children
comparison
equal deleted inserted replaced
40:55cadb1fac4b 41:c6e0df09b86f
12 int i; 12 int i;
13 int16_t *q = vec_malloc(16000001u * 2u); 13 int16_t *q = vec_malloc(16000001u * 2u);
14 14
15 printf("\nsigned 16-bit audio sample min/max - 1 thousand passes - 16000001 samples\n\n"); 15 printf("\nsigned 16-bit audio sample min/max - 1 thousand passes - 16000001 samples\n\n");
16 16
17 /* generate random sample values */
18 for (i = 0; i < 16000001; i++)
19 q[i] = rand();
20
21 start = clock(); 17 start = clock();
22 for (i = 0; i < 1000; i++) { 18 for (i = 0; i < 100; i++) {
23 min = INT32_MAX; 19 min = INT32_MAX;
24 max = INT32_MIN; 20 max = INT32_MIN;
25 test_benchmark_sample_minmax_vec_impl(q, 16000001u, &min, &max); 21 test_benchmark_sample_minmax_vec_impl(q, 16000001u, &min, &max);
26 } 22 }
27 end = clock(); 23 end = clock();
28 24
29 printf("- vec: took %f secs\n", (double)(end - start) / CLOCKS_PER_SEC); 25 printf("- vec: took %f secs\n", (double)(end - start) / CLOCKS_PER_SEC);
30 26
31 start = clock(); 27 start = clock();
32 for (i = 0; i < 1000; i++) { 28 for (i = 0; i < 100; i++) {
33 min = INT32_MAX; 29 min = INT32_MAX;
34 max = INT32_MIN; 30 max = INT32_MIN;
35 test_benchmark_sample_minmax_simple_impl(q, 16000001u, &min, &max); 31 test_benchmark_sample_minmax_simple_impl(q, 16000001u, &min, &max);
36 } 32 }
37 end = clock(); 33 end = clock();