template<class keytype, class type>
Returns statistics useful for dynamic balancing of the table. If full exceeds 100%, then there are more items than slots and the table is no longer performing at maximum efficiency. If slotsspread is less than 50% then the hash function is broken. Ideally for performance purposes avrgkeysperslot should be near 1.0 and finally spread is slotsspread divided by avrgskeysperslot which is an overall indication of spread and thus efficiency of the table. Of course maximum efficiency is pointless for very large sets of data where avrgkeysperslot could be as much as eight - but slotsspread should always be near 100% Definition at line 255 of file qdictbase.h. Referenced by FX::QDictBase< FX::FXString, type >::statistics(). 00256 { 00257 if(full) *full=(float) 100.0*items/mysize; 00258 if(slotsspread || avrgkeysperslot || spread) 00259 { 00260 FXuint slotsused=0, keys=0; 00261 for(typename dictionary::const_iterator itdict=dict.begin(); itdict!=dict.end(); ++itdict) 00262 { 00263 const keyitemlist &kil=(*itdict); 00264 if(!kil.empty()) 00265 { 00266 slotsused++; 00267 keys+=(FXuint) kil.size(); 00268 } 00269 } 00270 if(slotsspread) *slotsspread=(float) 100.0*slotsused/FXMIN(mysize, items); 00271 if(avrgkeysperslot) *avrgkeysperslot=(float) keys/slotsused; 00272 if(spread) *spread=((float) 100.0*slotsused/FXMIN(mysize, items))/((float) keys/slotsused); 00273 } 00274 }
|