JCL Help:TExprHashContext.Create

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Creates an instance of THashContext.


Pascal

 public constructor Create(ACaseSensitive: Boolean = False; AHashSize: Integer = 127);


Parameters

Parameters Description
ACaseSensitive: Boolean = False Whether this context should be case sensitive or not.
AHashSize: Integer = 127 The hash size to pass on to the internal hash map structure.


Description

This constructs an instance of THashContext. The first parameter indicates case sensitivity; the meaning of the second parameter is slightly more subtle. It tells the context what value to pass on to the internal hash map's constructor. A large value will mean that the context will take up quite a bit of memory even when it is empty (4 bytes are added for every increase of 1 in the hash size). For good performance, the hash should roughly be the expected average amount of items to be held in the hash. The performance degradation for too small hash tables is logarithmic, however, so only in pathalogical cases should this be a concern.


See Also

TStringHashMap


About

Donator

Barry Kelly


Notes

It is fairly important that the hash size not be an even number; it's best if it is a prime number, although typically a power of 2 minus one does fairly well (e.g. 127, 2047, etc.).


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page