Example #1
0
            /// <summary>
            /// Construct.
            /// </summary>
            internal BucketedPrioritizedStringList(bool gatherStatistics, int smallMruSize, int largeMruSize, int hugeMruSize, int smallMruThreshold, int largeMruThreshold, int hugeMruThreshold, int ginormousThreshold, bool useSimpleConcurrency)
            {
                if (smallMruSize == 0 && largeMruSize == 0 && hugeMruSize == 0)
                {
                    _dontTrack = true;
                }

                _smallMru             = new PrioritizedStringList(smallMruSize);
                _largeMru             = new PrioritizedStringList(largeMruSize);
                _hugeMru              = new PrioritizedStringList(hugeMruSize);
                _smallMruThreshold    = smallMruThreshold;
                _largeMruThreshold    = largeMruThreshold;
                _hugeMruThreshold     = hugeMruThreshold;
                _ginormousThreshold   = ginormousThreshold;
                _useSimpleConcurrency = useSimpleConcurrency;

                for (int i = 0; i < GinormousSize; i++)
                {
                    _ginormous.AddFirst(new WeakReference(string.Empty));
                }

                _gatherStatistics = gatherStatistics;
                if (gatherStatistics)
                {
                    _stopwatch       = new Stopwatch();
                    _missedStrings   = new Dictionary <string, int>(StringComparer.Ordinal);
                    _rejectedStrings = new Dictionary <string, int>(StringComparer.Ordinal);
                }
            }
            /// <summary>
            /// Construct.
            /// </summary>
            internal BucketedPrioritizedStringList(bool gatherStatistics, int smallMruSize, int largeMruSize, int hugeMruSize, int smallMruThreshhold, int largeMruThreshhold, int hugeMruThreshhold, int ginormousThreshhold)
            {
                if (smallMruSize == 0 && largeMruSize == 0 && hugeMruSize == 0)
                {
                    _dontTrack = true;
                }

                _smallMru = new PrioritizedStringList(smallMruSize);
                _largeMru = new PrioritizedStringList(largeMruSize);
                _hugeMru = new PrioritizedStringList(hugeMruSize);
                _smallMruThreshhold = smallMruThreshhold;
                _largeMruThreshhold = largeMruThreshhold;
                _hugeMruThreshhold = hugeMruThreshhold;
                _ginormousThreshhold = ginormousThreshhold;

                for (int i = 0; i < _ginormousSize; i++)
                {
                    _ginormous.AddFirst(new WeakReference(String.Empty));
                }

                _gatherStatistics = gatherStatistics;
                if (gatherStatistics)
                {
                    _stopwatch = new Stopwatch();
                    _missedStrings = new Dictionary<string, int>(StringComparer.Ordinal);
                    _rejectedStrings = new Dictionary<string, int>(StringComparer.Ordinal);
                }
            }