Skip to content
Myr

update test_ds.c

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sean Barrett · committed by Sean Barrett · parent 30496e2 · Browse files · 1 file+641 added−29 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+641 added−29 removed

  • tests:+641 added−29 removed

1 file+641 added−29 removed

modified:tests/test_ds.c+641 added-29 removed
1#ifdef DS_PERF2#define _CRT_SECURE_NO_WARNINGS3#define _CRT_NONSTDC_NO_DEPRECATE4#define _CRT_NON_CONFORMING_SWPRINTFS567//#define STBDS_INTERNAL_SMALL_BUCKET // make 64-bit bucket fit both keys and hash bits8//#define STBDS_SIPHASH_2_4 // performance test 1_3 against 2_49//#define STBDS_INTERNAL_BUCKET_START // don't bother offseting differently within bucket for different hash values10//#define STBDS_FLUSH_CACHE (1u<<20) // do this much memory traffic to flush the cache between some benchmarking measurements1112#define WIN32_LEAN_AND_MEAN13#include <windows.h>14#define STB_DEFINE15#define STB_NO_REGISTRY16#include "../stb.h"17#include <stdio.h>18#endif1920#ifdef DS_TEST21#define STBDS_UNIT_TESTS22#define STBDS_SMALL_BUCKET23#endif2425#ifdef DS_STATS26#define STBDS_STATISTICS
3 unmodified lines
30#define STBDS_ASSERT assert31#include <assert.h>32#endif3316//#define STBDS_SIPHASH_2_434#define STB_DS_IMPLEMENTATION35#include "../stb_ds.h"3637size_t churn_inserts, churn_deletes;
119 unmodified lines
157 return 0;158}159#endif160161162#ifdef DS_PERF145#define WIN32_LEAN_AND_MEAN146#include <windows.h>147#define STB_DEFINE148#define STB_NO_REGISTRY149//#include "../stb.h"163//char *strdup(const char *foo) { return 0; }164//int stricmp(const char *a, const char *b) { return 0; }165//int strnicmp(const char *a, const char *b, size_t n) { return 0; }166151152size_t t0, sum, mn,mx,count;167unsigned __int64 t0, xsum, mn,mx,count;168void begin(void)169{155 size_t t0;170 LARGE_INTEGER m;171 QueryPerformanceCounter(&m);172 t0 = m.QuadPart;159 sum = 0;173 xsum = 0;174 count = 0;175 mx = 0;162 mn = ~(size_t) 0;176 mn = ~(unsigned __int64) 0;177}178179void measure(void)180{167 size_t t1, t;181 unsigned __int64 t1, t;182 LARGE_INTEGER m;183 QueryPerformanceCounter(&m);184 t1 = m.QuadPart;185 t = t1-t0;186 if (t1 < t0)187 printf("ALERT: QueryPerformanceCounter was unordered!\n");188 if (t < mn) mn = t;189 if (t > mx) mx = t;176 sum += t;190 xsum += t;191 ++count;192 t0 = t1;193}194195void dont_measure(void)196{183 size_t t1, t;197 LARGE_INTEGER m;198 QueryPerformanceCounter(&m);199 t0 = m.QuadPart;200}201202double timer;190void end(void)203double end(void)204{205 LARGE_INTEGER m;206 QueryPerformanceFrequency(&m);207208 if (count > 3) {209 // discard the highest and lowest197 sum -= mn;198 sum -= mx;210 xsum -= mn;211 xsum -= mx;212 count -= 2;213 }201 timer = (double) (sum) / count / m.QuadPart * 1000;214 timer = (double) (xsum) / count / m.QuadPart * 1000;215 return timer;216}217218void build(int a, int b, int count, int step)219{220 struct { int key,value; } *map=NULL;207 int i,j,n,k;208 for (i=0; i < a; ++i)209 hmput(map,i*step,i+1);221 int i,n;222 for (i=0; i < a; ++i) {223 n = i*step;224 hmput(map,n,i+1);225 }226 measure();227 churn_inserts = i;228 hmfree(map);229 dont_measure();
2 unmodified lines
232#ifdef STB__INCLUDE_STB_H233void build_stb(int a, int b, int count, int step)234{235 stb_idict *d = stb_idict_new_size(8);220 struct { int key,value; } *map=NULL;221 int i,j,n,k;236 int i;237 for (i=0; i < a; ++i)238 stb_idict_add(d, i*step, i+1);239 measure();240 churn_inserts = i;241 stb_idict_destroy(d);242 dont_measure();243}244245void multibuild_stb(int a, int b, int count, int step, int tables)246{247 stb_idict *d[50000];248 int i,q;249 for (q=0; q < tables; ++q)250 d[q] = stb_idict_new_size(8);251 dont_measure();252 for (i=0; i < a; ++i)253 for (q=0; q < tables; ++q)254 stb_idict_add(d[q], i*step+q*771, i+1);255 measure();256 churn_inserts = i;257 for (q=0; q < tables; ++q)258 stb_idict_destroy(d[q]);259 dont_measure();260}261262int multisearch_stb(int a, int start, int end, int step, int tables)263{264 stb_idict *d[50000];265 int i,q,total=0,v;266 for (q=0; q < tables; ++q)267 d[q] = stb_idict_new_size(8);268 for (q=0; q < tables; ++q)269 for (i=0; i < a; ++i)270 stb_idict_add(d[q], i*step+q*771, i+1);271 dont_measure();272 for (i=start; i < end; ++i)273 for (q=0; q < tables; ++q)274 if (stb_idict_get_flag(d[q], i*step+q*771, &v))275 total += v;276 measure();277 churn_inserts = i;278 for (q=0; q < tables; ++q)279 stb_idict_destroy(d[q]);280 dont_measure();281 return total;282}283#endif284285int multisearch(int a, int start, int end, int step, int tables)286{287 struct { int key,value; } *hash[50000];288 int i,q,total=0;289 for (q=0; q < tables; ++q)290 hash[q] = NULL;291 for (q=0; q < tables; ++q)292 for (i=0; i < a; ++i)293 hmput(hash[q], i*step+q*771, i+1);294 dont_measure();295 for (i=start; i < end; ++i)296 for (q=0; q < tables; ++q)297 total += hmget(hash[q], i*step+q*771);298 measure();299 churn_inserts = i;300 for (q=0; q < tables; ++q)301 hmfree(hash[q]);302 dont_measure();303 return total;304}305306void churn_skip(unsigned int a, unsigned int b, int count)307{308 struct { unsigned int key,value; } *map=NULL;309 unsigned int i,j,n,k;
107 unmodified lines
417 churn_deletes = (b-a) * n;418 dont_measure();419}420421void multichurn4(int a, int b, int count, int include_startup, int tables)422{423 struct { int key,value; } *map[50000];424 int i,j,n,k,q;425 for (q=0; q < tables; ++q)426 map[q] = NULL;427 dont_measure();428429 for (i=0; i < a; ++i)430 for (q=0; q < tables; ++q)431 hmput(map[q],i,i+1);432 if (!include_startup)433 dont_measure();434 for (n=0; n < count; ++n) {435 for (j=a; j < b; ++j,++i) {436 for (q=0; q < tables; ++q)437 hmput(map[q],i,i+1);438 }439 assert(hmlen(map[0]) == b);440 for (j=a; j < b; ++j) {441 k=i-j-1;442 for (q=0; q < tables; ++q)443 k = hmdel(map[q],k);444 assert(k != 0);445 }446 assert(hmlen(map[0]) == a);447 }448 measure();449 for (q=0; q < tables; ++q)450 hmfree(map[q]);451 churn_inserts = i * tables;452 churn_deletes = (b-a) * n * tables;453 dont_measure();454}455456struct {457 unsigned __int64 start;458 unsigned __int64 end;459 int table_size;460} mstats[32][4000];461462const int first_step = 64;463const int last_step = 384-48; // 32M464465void measure_build4(int step_log2)466{467 double length;468 int i,j,k=0;469 int step = 1 << step_log2;470 unsigned __int64 t0,t1;471 struct { int key,value; } *map=NULL;472 double rdtsc_scale;473 begin();474 t0 = __rdtsc();475476 mstats[0][0].start = __rdtsc();477 for (i=0; i < 256; ++i) {478 hmput(map,k,k+1);479 k += step;480 }481 mstats[0][first_step-1].end = __rdtsc();482 mstats[0][first_step-1].table_size = k >> step_log2;483 for (j=first_step; j < last_step; ++j) {484 for (i=0; i < (1<<(j>>4)); ++i) {485 hmput(map, k,k+1);486 k += step;487 }488 mstats[0][j].end = __rdtsc();489 mstats[0][j].table_size = k >> step_log2;490 }491 t1 = __rdtsc();492 measure();493 hmfree(map);494 length = end();495 rdtsc_scale = length / (t1-t0) * 1000;496497 for (j=1; j < last_step; ++j)498 mstats[0][j].start = mstats[0][0].start;499 for (j=first_step-1; j < last_step; ++j) {500 printf("%12.4f,%12d,%12d,0,0,0\n", (mstats[0][j].end - mstats[0][j].start) * rdtsc_scale, mstats[0][j].table_size, mstats[0][j].table_size);501 }502}503504#ifdef STBDS_FLUSH_CACHE505static int cache_index;506char dummy[8][STBDS_FLUSH_CACHE];507508int flush_cache(void)509{510 memmove(dummy[cache_index],dummy[cache_index]+1, sizeof(dummy[cache_index])-1);511 cache_index = (cache_index+1)%8;512 return dummy[cache_index][0];513}514#else515int flush_cache(void) { return 0; }516#endif517518int measure_average_lookup4(int step_log2)519{520 int total;521 double length;522 int i,j,k=0,q;523 int step = 1 << step_log2;524 unsigned __int64 t0,t1;525 struct { int key,value; } *map=NULL;526 double rdtsc_scale;527 begin();528 t0 = __rdtsc();529530 for (i=0; i < 128; ++i) {531 hmput(map,k,k+1);532 k += step;533 }534 for (j=first_step; j <= last_step; ++j) {535 total += flush_cache();536 mstats[0][j].start = __rdtsc();537 for (q=i=0; i < 50000; ++i) {538 total += hmget(map, q); // hit539 if (++q == k) q = 0;540 }541 mstats[0][j].end = __rdtsc();542 mstats[0][j].table_size = k;543 total += flush_cache();544 mstats[1][j].start = __rdtsc();545 for (i=0; i < 50000; ++i) {546 total += hmget(map, i+k); // miss547 }548 mstats[1][j].end = __rdtsc();549 mstats[1][j].table_size = k;550551 // expand table552 for (i=0; i < (1<<(j>>4)); ++i) {553 hmput(map, k,k+1);554 k += step;555 }556 }557558 t1 = __rdtsc();559 measure();560 hmfree(map);561 length = end();562 rdtsc_scale = length / (t1-t0) * 1000;563564 for (j=first_step; j <= last_step; ++j) {565 // time,table_size,numins,numhit,nummiss,numperflush566 printf("%12.4f,%12d,0,50000,0,0\n", (mstats[0][j].end - mstats[0][j].start) * rdtsc_scale, mstats[0][j].table_size);567 }568 for (j=first_step; j <= last_step; ++j) {569 printf("%12.4f,%12d,0,0,50000,0\n", (mstats[1][j].end - mstats[1][j].start) * rdtsc_scale, mstats[1][j].table_size);570 }571 return total;572}573574int measure_worst_lookup4_a(int step_log2)575{576 int total;577 double length;578 int i,j,k=0,q,worst_q,n,z,attempts;579 int step = 1 << step_log2;580 unsigned __int64 t0,t1;581 unsigned __int64 m0,m1,worst;582 struct { int key,value; } *map=NULL;583 double rdtsc_scale;584 begin();585 t0 = __rdtsc();586587 memset(mstats, 0, sizeof(mstats));588 for (j=first_step; j <= last_step; ++j)589 mstats[0][j].end = mstats[1][j].end = ~(unsigned __int64) 0;590591 for(attempts=0; attempts < 2; ++attempts) {592 k = 0;593 stbds_rand_seed(0); // force us to get the same table every time594 for (i=0; i < 128; ++i) {595 hmput(map,k,k+1);596 k += step;597 }598 for (j=first_step; j <= last_step; ++j) {599 unsigned __int64 times[32];600601 // find the worst hit time602 for (z=0; z < 2; ++z) { // try the bisectioning measurement 4 times603 worst = 0;604 for (n=0; n < 10; ++n) { // test 400 keys total605 // find the worst time to hit 20 keys606 q=0;607 worst_q = 0;608 total += flush_cache();609 m0 = __rdtsc();610 for (i=0; i < 20; ++i) {611 total += hmget(map, q); // hit612 if (++q == k) q = 0;613 }614 m1 = __rdtsc();615 // for each n, check if this is the worst lookup we've seen616 if (m1 - m0 > worst) {617 worst = m1-m0;618 worst_q = q - i;619 if (worst_q < 0) q += k;620 }621 }622 // after 400 keys, take the worst 20 keys, and try each one623 worst = 0;624 q = worst_q;625 for (i=0; i < 20; ++i) {626 total += flush_cache();627 m0 = __rdtsc();628 total += hmget(map, q); // hit629 m1 = __rdtsc();630 if (m1 - m0 > worst)631 worst = m1-m0;632 if (++q == k) q = 0;633 }634 times[z] = worst;635 }636 // find the worst time in the bunch637 worst = 0;638 for (i=0; i < z; ++i)639 if (times[i] > worst)640 worst = times[i];641 // take the best of 'attempts', to discard outliers642 if (worst < mstats[0][j].end)643 mstats[0][j].end = worst;644 mstats[0][j].start = 0;645 mstats[0][j].table_size = k >> step_log2;646647 // find the worst miss time648 for (z=0; z < 8; ++z) { // try the bisectioning measurement 8 times649 worst = 0;650 for (n=0; n < 20; ++n) { // test 400 keys total651 // find the worst time to hit 20 keys652 q=k;653 worst_q = 0;654 total += flush_cache();655 m0 = __rdtsc();656 for (i=0; i < 20; ++i) {657 total += hmget(map, q); // hit658 }659 m1 = __rdtsc();660 // for each n, check if this is the worst lookup we've seen661 if (m1 - m0 > worst) {662 worst = m1-m0;663 worst_q = q - i;664 }665 }666 // after 400 keys, take the worst 20 keys, and try each one667 worst = 0;668 q = worst_q;669 for (i=0; i < 20; ++i) {670 total += flush_cache();671 m0 = __rdtsc();672 total += hmget(map, q); // hit673 m1 = __rdtsc();674 if (m1 - m0 > worst)675 worst = m1-m0;676 }677 times[z] = worst;678 }679 // find the worst time in the bunch680 worst = 0;681 for (i=0; i < z; ++i)682 if (times[i] > worst)683 worst = times[i];684 if (worst < mstats[1][j].end)685 mstats[1][j].end = worst;686 mstats[1][j].start = 0;687 mstats[1][j].table_size = k >> step_log2;688689 // expand table690 for (i=0; i < (1<<(j>>4)); ++i) {691 hmput(map, k,k+1);692 k += step;693 }694 }695 hmfree(map);696 }697698 t1 = __rdtsc();699 measure();700 length = end();701 rdtsc_scale = length / (t1-t0) * 1000;702703 for (j=first_step; j <= last_step; ++j) {704 printf("%12.4f,%12d,0,1,0,1\n", (mstats[0][j].end - mstats[0][j].start) * rdtsc_scale, mstats[0][j].table_size);705 }706 for (j=first_step; j <= last_step; ++j) {707 printf("%12.4f,%12d,0,0,1,1\n", (mstats[1][j].end - mstats[1][j].start) * rdtsc_scale, mstats[1][j].table_size);708 }709 return total;710}711712int measure_worst_lookup4_b(int step_log2)713{714 int total;715 double length;716 int i,j,k=0,q,worst_q,n,z,attempts;717 int step = 1 << step_log2;718 unsigned __int64 t0,t1;719 unsigned __int64 m0,m1,worst;720 struct { int key,value; } *map=NULL;721 double rdtsc_scale;722 begin();723 t0 = __rdtsc();724725 memset(mstats, 0, sizeof(mstats));726 for (j=first_step; j <= last_step; ++j)727 mstats[0][j].end = mstats[1][j].end = ~(unsigned __int64) 0;728729 k = 0;730 stbds_rand_seed(0); // force us to get the same table every time731 for (i=0; i < 128; ++i) {732 hmput(map,k,k+1);733 k += step;734 }735 for (j=first_step; j <= last_step; ++j) {736 unsigned __int64 times[32];737738 // find the worst hit time739 for (z=0; z < 8; ++z) { // try this 8 times740 worst = 0;741 q=0;742 for (i=0; i < 5000; ++i) {743 total += hmget(map, q);744 m0 = __rdtsc();745 total += hmget(map, q);746 m1 = __rdtsc();747 if (m1 - m0 > worst) {748 worst = m1-m0;749 worst_q = q - i;750 }751 if (++q == k) q = 0;752 }753 // now retry with the worst one, but find the shortest time for it754 worst = ~(unsigned __int64) 0;755 for (i=0; i < 4; ++i) {756 total += flush_cache();757 m0 = __rdtsc();758 total += hmget(map,worst_q);759 m1 = __rdtsc();760 if (m1-m0 < worst)761 worst = m1-m0;762 }763 times[z] = worst;764 }765766 // find the worst of those767 worst = 0;768 for (i=0; i < z; ++i)769 if (times[i] > worst)770 worst = times[i];771 mstats[0][j].start = 0;772 mstats[0][j].end = worst;773 mstats[0][j].table_size = k;774775 // find the worst miss time776 for (z=0; z < 8; ++z) { // try this 8 times777 worst = 0;778 q=k;779 for (i=0; i < 5000; ++i) {780 total += hmget(map, q);781 m0 = __rdtsc();782 total += hmget(map, q);783 m1 = __rdtsc();784 if (m1 - m0 > worst) {785 worst = m1-m0;786 worst_q = q - i;787 }788 //printf("%6llu ", m1-m0);789 }790 // now retry with the worst one, but find the shortest time for it791 worst = ~(unsigned __int64) 0;792 for (i=0; i < 4; ++i) {793 total += flush_cache();794 m0 = __rdtsc();795 total += hmget(map,worst_q);796 m1 = __rdtsc();797 if (m1-m0 < worst)798 worst = m1-m0;799 }800 times[z] = worst;801 }802803 // find the worst of those804 worst = 0;805 for (i=0; i < z; ++i)806 if (times[i] > worst)807 worst = times[i];808 mstats[1][j].start = 0;809 mstats[1][j].end = worst;810 mstats[1][j].table_size = k;811812 // expand table813 for (i=0; i < (1<<(j>>4)); ++i) {814 hmput(map, k,k+1);815 k += step;816 }817 }818 hmfree(map);819820 t1 = __rdtsc();821 measure();822 length = end();823 rdtsc_scale = length / (t1-t0) * 1000;824825 for (j=first_step+1; j <= last_step; ++j) {826 printf("%12.4f,%12d,0,1,0,1\n", (mstats[0][j].end - mstats[0][j].start) * rdtsc_scale, mstats[0][j].table_size);827 }828 for (j=first_step+1; j <= last_step; ++j) {829 printf("%12.4f,%12d,0,0,1,1\n", (mstats[1][j].end - mstats[1][j].start) * rdtsc_scale, mstats[1][j].table_size);830 }831 return total;832}833834int measure_uncached_lookup4(int step_log2)835{836 int total;837 double length;838 int i,j,k=0,q;839 int step = 1 << step_log2;840 unsigned __int64 t0,t1;841 struct { int key,value; } *map=NULL;842 double rdtsc_scale;843 begin();844 t0 = __rdtsc();845846 map = NULL;847 for (i=0; i < 128; ++i) {848 hmput(map,k,k+1);849 k += step;850 }851 for (j=first_step; j <= last_step; ++j) {852 mstats[0][j].start = __rdtsc();853 mstats[0][j].end = 0;854 for (q=i=0; i < 512; ++i) {855 if ((i & 3) == 0) {856 mstats[0][j].end += __rdtsc();857 total += flush_cache();858 mstats[0][j].start += __rdtsc();859 }860 total += hmget(map, q); // hit861 if (++q == k) q = 0;862 }863 mstats[0][j].end += __rdtsc();864 mstats[0][j].table_size = k;865 total += flush_cache();866 mstats[1][j].end = 0;867 mstats[1][j].start = __rdtsc();868 for (i=0; i < 512; ++i) {869 if ((i & 3) == 0) {870 mstats[1][j].end += __rdtsc();871 total += flush_cache();872 mstats[1][j].start += __rdtsc();873 }874 total += hmget(map, i+k); // miss875 }876 mstats[1][j].end += __rdtsc();877 mstats[1][j].table_size = k;878879 // expand table880 for (i=0; i < (1<<(j>>4)); ++i) {881 hmput(map, k,k+1);882 k += step;883 }884 }885 hmfree(map);886887 t1 = __rdtsc();888 measure();889 length = end();890 rdtsc_scale = length / (t1-t0) * 1000;891892 for (j=first_step; j <= last_step; ++j) {893 printf("%12.4f,%12d,0,512,0,4\n", (mstats[0][j].end - mstats[0][j].start) * rdtsc_scale, mstats[0][j].table_size);894 }895 for (j=first_step; j <= last_step; ++j) {896 printf("%12.4f,%12d,0,0,512,4\n", (mstats[1][j].end - mstats[1][j].start) * rdtsc_scale, mstats[1][j].table_size);897 }898 return total;899}900901902903904int main(int arg, char **argv)905{906 int n,s,w;907 double worst = 0;908909 printf("# size_t=%d,", (int) sizeof(size_t));910911// number of cache-lines912#ifdef STBDS_SMALL_BUCKET913 printf("cacheline=%d,", 1);914#else915 printf("cacheline=%d,", sizeof(size_t)==8 ? 2 : 1);916#endif917#ifdef STBDS_FLUSH_CACHE918 printf("%d,", (int) stbds_log2(STBDS_FLUSH_CACHE));919#else920 printf("0,");921#endif922#ifdef STBDS_BUCKET_START // don't bother offseting differently within bucket for different hash values923 printf("STBDS_BUCKET_START,");924#else925 printf(",");926#endif927#ifdef STBDS_SIPHASH_2_4928 printf("STBDS_SIPHASH_2_4,");929#else930 printf(",");931#endif932 printf("\n");933934 measure_worst_lookup4_b(0);935 //measure_worst_lookup4_a(0);936 measure_average_lookup4(0);937 measure_uncached_lookup4(0);938 measure_build4(0);939 return 0;940941#if 0942 begin(); for (n=0; n < 2000; ++n) { build_stb(2000,0,0,1); } end(); printf(" // %7.2fms : 2,000 inserts creating 2K table\n", timer);943 begin(); for (n=0; n < 500; ++n) { build_stb(20000,0,0,1); } end(); printf(" // %7.2fms : 20,000 inserts creating 20K table\n", timer);944 begin(); for (n=0; n < 100; ++n) { build_stb(200000,0,0,1); } end(); printf(" // %7.2fms : 200,000 inserts creating 200K table\n", timer);945 begin(); for (n=0; n < 10; ++n) { build_stb(2000000,0,0,1); } end(); printf(" // %7.2fms : 2,000,000 inserts creating 2M table\n", timer);946 begin(); for (n=0; n < 5; ++n) { build_stb(20000000,0,0,1); } end(); printf(" // %7.2fms : 20,000,000 inserts creating 20M table\n", timer);947#endif948360 begin(); for (n=0; n < 2000; ++n) { churn8(2000,0,0,1); } end(); printf(" // %7.2fms : 2,000 inserts creating 2K table w/ 8-byte key\n", timer);361 begin(); for (n=0; n < 500; ++n) { churn8(20000,0,0,1); } end(); printf(" // %7.2fms : 20,000 inserts creating 20K table w/ 8-byte key\n", timer);362 begin(); for (n=0; n < 100; ++n) { churn8(200000,0,0,1); } end(); printf(" // %7.2fms : 200,000 inserts creating 200K table w/ 8-byte key\n", timer);363 begin(); for (n=0; n < 10; ++n) { churn8(2000000,0,0,1); } end(); printf(" // %7.2fms : 2,000,000 inserts creating 2M table w/ 8-byte key\n", timer);364 begin(); for (n=0; n < 5; ++n) { churn8(20000000,0,0,1); } end(); printf(" // %7.2fms : 20,000,000 inserts creating 20M table w/ 8-byte key\n", timer);365949#if 0950 begin(); for (n=0; n < 2000; ++n) { churn32(2000,0,0,1); } end(); printf(" // %7.2fms : 2,000 inserts creating 2K table w/ 32-byte key\n", timer);951 begin(); for (n=0; n < 500; ++n) { churn32(20000,0,0,1); } end(); printf(" // %7.2fms : 20,000 inserts creating 20K table w/ 32-byte key\n", timer);952 begin(); for (n=0; n < 100; ++n) { churn32(200000,0,0,1); } end(); printf(" // %7.2fms : 200,000 inserts creating 200K table w/ 32-byte key\n", timer);
6 unmodified lines
959 begin(); for (n=0; n < 10; ++n) { churn256(2000000,0,0,1); } end(); printf(" // %7.2fms : 2,000,000 inserts creating 2M table w/ 256-byte key\n", timer);960 begin(); for (n=0; n < 5; ++n) { churn256(20000000,0,0,1); } end(); printf(" // %7.2fms : 20,000,000 inserts creating 20M table w/ 256-byte key\n", timer);961#endif962963 begin(); for (n=0; n < 20; ++n) { multisearch_stb(2000,0,2000,1,1000); } end(); printf(" // %7.2fms : 2,000,000 hits on 1,000 2K table w/ 4-byte key\n", timer);964 begin(); for (n=0; n < 10; ++n) { multisearch_stb(20000,0,2000,1,1000); } end(); printf(" // %7.2fms : 2,000,000 hits on 1,000 20K table w/ 4-byte key\n", timer);965 begin(); for (n=0; n < 6; ++n) { multisearch_stb(200000,0,2000,1,1000); } end(); printf(" // %7.2fms : 2,000,000 hits on 1,000 200K table w/ 4-byte key\n", timer);966 begin(); for (n=0; n < 2; ++n) { multisearch_stb(2000000,0,20000,1,100); } end(); printf(" // %7.2fms : 2,000,000 hits on 100 2M table w/ 4-byte key\n", timer);967968 begin(); for (n=0; n < 20; ++n) { multisearch (2000,0,2000,1,1000); } end(); printf(" // %7.2fms : 2,000,000 hits on 1,000 2K table w/ 4-byte key\n", timer);969 begin(); for (n=0; n < 10; ++n) { multisearch (20000,0,2000,1,1000); } end(); printf(" // %7.2fms : 2,000,000 hits on 1,000 20K table w/ 4-byte key\n", timer);970 begin(); for (n=0; n < 6; ++n) { multisearch (200000,0,2000,1,1000); } end(); printf(" // %7.2fms : 2,000,000 hits on 1,000 200K table w/ 4-byte key\n", timer);971 begin(); for (n=0; n < 2; ++n) { multisearch (2000000,0,20000,1,100); } end(); printf(" // %7.2fms : 2,000,000 hits on 100 2M table w/ 4-byte key\n", timer);972973974#if 1975 begin(); for (n=0; n < 2; ++n) { multibuild_stb(2000,0,0,1,10000); } end(); printf(" // %7.2fms : 20,000,000 inserts creating 10,000 2K table w/ 4-byte key\n", timer);976 begin(); for (n=0; n < 2; ++n) { multibuild_stb(20000,0,0,1,1000); } end(); printf(" // %7.2fms : 20,000,000 inserts creating 1,000 20K table w/ 4-byte key\n", timer);977 begin(); for (n=0; n < 2; ++n) { multibuild_stb(200000,0,0,1,100); } end(); printf(" // %7.2fms : 20,000,000 inserts creating 100 200K table w/ 4-byte key\n", timer);978 begin(); for (n=0; n < 2; ++n) { multibuild_stb(2000000,0,0,1,10); } end(); printf(" // %7.2fms : 20,000,000 inserts creating 10 2M table w/ 4-byte key\n", timer);979980 begin(); for (n=0; n < 2; ++n) { multichurn4(2000,0,0,1,10000); } end(); printf(" // %7.2fms : 20,000,000 inserts creating 10,000 2K table w/ 4-byte key\n", timer);981 begin(); for (n=0; n < 2; ++n) { multichurn4(20000,0,0,1,1000); } end(); printf(" // %7.2fms : 20,000,000 inserts creating 1,000 20K table w/ 4-byte key\n", timer);982 begin(); for (n=0; n < 2; ++n) { multichurn4(200000,0,0,1,100); } end(); printf(" // %7.2fms : 20,000,000 inserts creating 100 200K table w/ 4-byte key\n", timer);983 begin(); for (n=0; n < 2; ++n) { multichurn4(2000000,0,0,1,10); } end(); printf(" // %7.2fms : 20,000,000 inserts creating 10 2M table w/ 4-byte key\n", timer);984#endif985986 begin(); for (n=0; n < 2000; ++n) { build(2000,0,0,1); } end(); printf(" // %7.2fms : 2,000 inserts creating 2K table w/ 4-byte key\n", timer);987 begin(); for (n=0; n < 500; ++n) { build(20000,0,0,1); } end(); printf(" // %7.2fms : 20,000 inserts creating 20K table w/ 4-byte key\n", timer);988 begin(); for (n=0; n < 100; ++n) { build(200000,0,0,1); } end(); printf(" // %7.2fms : 200,000 inserts creating 200K table w/ 4-byte key\n", timer);989 begin(); for (n=0; n < 10; ++n) { build(2000000,0,0,1); } end(); printf(" // %7.2fms : 2,000,000 inserts creating 2M table w/ 4-byte key\n", timer);990 begin(); for (n=0; n < 5; ++n) { build(20000000,0,0,1); } end(); printf(" // %7.2fms : 20,000,000 inserts creating 20M table w/ 4-byte key\n", timer);991992 begin(); for (n=0; n < 2000; ++n) { churn8(2000,0,0,1); } end(); printf(" // %7.2fms : 2,000 inserts creating 2K table w/ 8-byte key\n", timer);993 begin(); for (n=0; n < 500; ++n) { churn8(20000,0,0,1); } end(); printf(" // %7.2fms : 20,000 inserts creating 20K table w/ 8-byte key\n", timer);994 begin(); for (n=0; n < 100; ++n) { churn8(200000,0,0,1); } end(); printf(" // %7.2fms : 200,000 inserts creating 200K table w/ 8-byte key\n", timer);995 begin(); for (n=0; n < 10; ++n) { churn8(2000000,0,0,1); } end(); printf(" // %7.2fms : 2,000,000 inserts creating 2M table w/ 8-byte key\n", timer);996 begin(); for (n=0; n < 5; ++n) { churn8(20000000,0,0,1); } end(); printf(" // %7.2fms : 20,000,000 inserts creating 20M table w/ 8-byte key\n", timer);997998 begin(); for (n=0; n < 60; ++n) { churn_skip(2000,2100,5000); } end(); printf(" // %7.2fms : 500,000 inserts & deletes in 2K table\n", timer);999 begin(); for (n=0; n < 30; ++n) { churn_skip(20000,21000,500); } end(); printf(" // %7.2fms : 500,000 inserts & deletes in 20K table\n", timer);1000 begin(); for (n=0; n < 15; ++n) { churn_skip(200000,201000,500); } end(); printf(" // %7.2fms : 500,000 inserts & deletes in 200K table\n", timer);1001 begin(); for (n=0; n < 8; ++n) { churn_skip(2000000,2001000,500); } end(); printf(" // %7.2fms : 500,000 inserts & deletes in 2M table\n", timer);
29 unmodified lines