-
- printf("up2pow [5] = [%i]\n",ston_up2pow(5));
- for (i = 0; i < 77; i += 7)
- printf("trailing0 [%X] = [%x]\n",(uint32_t)i,ston_trailing0(i));
-
- columns = 2;
- elements = 1;
- ht = ston_ht32_new(columns,elements,0,malloc);
- check_ht(ht);
- key = 0xFF;
- val[0] = key;
- val[1] = 0x5;
- printf("ht32_insertx: [%x] = ", key);
- print_val(val);
- ston_ht32_insertx(ht,key,val,0,columns);
- idx = 1;
- htval = ston_ht32_row(ht,key);
- printf("Read value [%x] matches: %s"CLRCN, htval[idx],
- (htval[idx] == val[idx]) ? GREEN"PASS" : RED"FAIL");
-
- val[1] = 0x2;
- previous_val = ston_ht32_insert(ht,key,1,val[1]);
- printf("ht32_insert: [%x] = ", key);
- print_val(val);
- printf("Previous value [%x] matches [5]: %s"CLRCN, previous_val,
- (previous_val == 0x5) ? GREEN"PASS" : RED"FAIL");
-
- free(ht);
-
- columns = 4;
- elements = 20;
- ht = ston_ht32_new(columns,elements,0,malloc);
- check_ht(ht);
- printf("Filling hashtable with %i entries\n", (int)elements);
- for(key = 0xCEED; elements--; key *= 7)
- { val[0] = key;
- for(i = 1; i < columns; i++)
- val[i] = i * key;
- ston_ht32_insertx(ht,key,val,0,columns);
+ clock_t start, end;
+ int count;
+ printf("\nLow usage:\n");
+ do_test(2,200,ht,free,ston_ht32_new(2,200,0,malloc),ston_ht32_insertx,ston_ht32_row,0xCEED);
+ do_test(5,200,ht,free,ston_ht32_new(5,200,0,malloc),ston_ht32_insertx,ston_ht32_row,0xCEED);
+ do_test(2,200,dht,ston_dht_free,ston_dht32_new(2,malloc,free),ston_dht32_insertx,ston_dht32_row,0xCEED);
+ do_test(5,200,dht,ston_dht_free,ston_dht32_new(5,malloc,free),ston_dht32_insertx,ston_dht32_row,0xCEED);
+
+ printf("\nLow-mid usage:\n");
+ do_test(2,10000,ht,free,ston_ht32_new(2,10000,0,malloc),ston_ht32_insertx,ston_ht32_row,0xCEED);
+ do_test(5,10000,ht,free,ston_ht32_new(5,10000,0,malloc),ston_ht32_insertx,ston_ht32_row,0xCEED);
+ do_test(2,10000,dht,ston_dht_free,ston_dht32_new(2,malloc,free),ston_dht32_insertx,ston_dht32_row,0xCEED);
+ do_test(5,10000,dht,ston_dht_free,ston_dht32_new(5,malloc,free),ston_dht32_insertx,ston_dht32_row,0xCEED);
+
+ printf("\nMid usage:\n");
+ do_test(2,500000,ht,free,ston_ht32_new(2,500000,0,malloc),ston_ht32_insertx,ston_ht32_row,0xCEED);
+ do_test(5,500000,ht,free,ston_ht32_new(5,500000,0,malloc),ston_ht32_insertx,ston_ht32_row,0xCEED);
+ do_test(2,500000,dht,ston_dht_free,ston_dht32_new(2,malloc,free),ston_dht32_insertx,ston_dht32_row,0xCEED);
+ do_test(5,500000,dht,ston_dht_free,ston_dht32_new(5,malloc,free),ston_dht32_insertx,ston_dht32_row,0xCEED);
+
+ printf("\nIterator:\n");
+ dht = ston_dht_new(sizeof(uint32_t),sizeof(uint32_t),malloc,free);
+ dht2 = ston_dht_new(sizeof(uint32_t),sizeof(uint32_t),malloc,free);
+ for (count = 0; count < 50000; count++)
+ { key = XXH32(&count,4,0xCEED);
+ * (uint32_t*) ston_dht_val(dht,&key) = key * key;