BRZ is working with FCH or BMZ8. BMZ8 is faster but the MPHFs for each bucket are larger

This commit is contained in:
fc_botelho 2006-08-07 16:37:49 +00:00
parent 5334c9debc
commit 690dc3ee82
3 changed files with 13 additions and 1 deletions

View File

@ -28,7 +28,7 @@ brz_config_data_t *brz_config_new()
{ {
brz_config_data_t *brz = NULL; brz_config_data_t *brz = NULL;
brz = (brz_config_data_t *)malloc(sizeof(brz_config_data_t)); brz = (brz_config_data_t *)malloc(sizeof(brz_config_data_t));
brz->algo = CMPH_BMZ8; brz->algo = CMPH_FCH;
brz->b = 128; brz->b = 128;
brz->hashfuncs[0] = CMPH_HASH_JENKINS; brz->hashfuncs[0] = CMPH_HASH_JENKINS;
brz->hashfuncs[1] = CMPH_HASH_JENKINS; brz->hashfuncs[1] = CMPH_HASH_JENKINS;
@ -108,6 +108,15 @@ void brz_config_set_b(cmph_config_t *mph, cmph_uint8 b)
brz->b = b; brz->b = b;
} }
void brz_config_set_algo(cmph_config_t *mph, CMPH_ALGO algo)
{
if (algo == CMPH_BMZ8 || algo == CMPH_FCH) // supported algorithms
{
brz_config_data_t *brz = (brz_config_data_t *)mph->data;
brz->algo = algo;
}
}
cmph_t *brz_new(cmph_config_t *mph, float c) cmph_t *brz_new(cmph_config_t *mph, float c)
{ {
cmph_t *mphf = NULL; cmph_t *mphf = NULL;

View File

@ -11,6 +11,7 @@ void brz_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs);
void brz_config_set_tmp_dir(cmph_config_t *mph, cmph_uint8 *tmp_dir); void brz_config_set_tmp_dir(cmph_config_t *mph, cmph_uint8 *tmp_dir);
void brz_config_set_mphf_fd(cmph_config_t *mph, FILE *mphf_fd); void brz_config_set_mphf_fd(cmph_config_t *mph, FILE *mphf_fd);
void brz_config_set_b(cmph_config_t *mph, cmph_uint8 b); void brz_config_set_b(cmph_config_t *mph, cmph_uint8 b);
void brz_config_set_algo(cmph_config_t *mph, CMPH_ALGO algo);
void brz_config_set_memory_availability(cmph_config_t *mph, cmph_uint32 memory_availability); void brz_config_set_memory_availability(cmph_config_t *mph, cmph_uint32 memory_availability);
void brz_config_destroy(cmph_config_t *mph); void brz_config_destroy(cmph_config_t *mph);
cmph_t *brz_new(cmph_config_t *mph, float c); cmph_t *brz_new(cmph_config_t *mph, float c);

View File

@ -366,6 +366,8 @@ cmph_t *cmph_new(cmph_config_t *mph)
break; break;
case CMPH_BRZ: /* included -- Fabiano */ case CMPH_BRZ: /* included -- Fabiano */
DEBUGP("Creating brz hash\n"); DEBUGP("Creating brz hash\n");
if (c >= 2.0) brz_config_set_algo(mph, CMPH_FCH);
else brz_config_set_algo(mph, CMPH_BMZ8);
mphf = brz_new(mph, c); mphf = brz_new(mph, c);
break; break;
case CMPH_FCH: /* included -- Fabiano */ case CMPH_FCH: /* included -- Fabiano */