mpictor/StepClassLibrary — Issue #121: Performance - tweak hash table creation param
Author: mpictor
Created: 2012-01-06 01:11:56+00:00
State: open

`include/express/dict.h:92:#define DICTcreate(estimated_max_size) HASHcreate(estimated_max_size)`
If the number is too large, memory is wasted. If it is too small, lookups become inefficient.

To do this well, we'll need to figure out the average size of each table. For fedex_plus, perhaps the best way would be to count the number of lines in the schema, then for each table divide by some table-specific constant? Would the performance increase be substantial enough to bother?

In `src/clstepcore`, should the schema-specific lib provide size information for creation of the registry? Otherwise, we'll still have one-size-fits-all values that might be too small for good performance with ap210 but so big that simple schemas waste loads of memory.

`$ grep -nr DICTcreate src/*`

src/exppp/exppp.c:420: dict = DICTcreate( 10 );
src/express/schema.c:90: d->symbol_table = DICTcreate( 50 );
src/express/schema.c:98: d->symbol_table = DICTcreate( 1 );
src/express/schema.c:196: schema->u.schema->refdict = DICTcreate( 20 );
src/express/schema.c:212: schema->u.schema->usedict = DICTcreate( 20 );
src/express/expparse.y:779: CURRENT_SCOPE->symbol_table = DICTcreate(25);
src/express/expparse.y:1993: CURRENT_SCOPE->symbol_table = DICTcreate(25);
src/express/express.c:287: EXPRESSbuiltins = DICTcreate( 35 );
src/fedex_plus/classes.c:121: dict = DICTcreate( 10 );

`$ grep -nr HASHcreate src/*`

src/clstepcore/Registry.inline.cc:30: primordialSwamp = HASHcreate( 1000 );
src/clstepcore/Registry.inline.cc:31: active_schemas = HASHcreate( 10 );
src/clstepcore/Registry.inline.cc:32: active_types = HASHcreate( 100 );
src/clutils/scl_hash.h:135: SCL_UTILS_EXPORT struct Hash_Table * HASHcreate( unsigned );
src/clutils/scl_hash.cc:428: t = HASHcreate( 100 );
src/express/lexact.c:250: keyword_dictionary = HASHcreate( 100 ); /* not exact */
src/express/hash.c:588: t = HASHcreate( 100 );