Пример #1
0
 private static void _FastForEach(int threadIndex, IGetOrCreateValueSample sample)
 {
     for (int i = 0; i < _COUNT_ITERATIONS_FASTCREATOR; i++)
     {
         if (sample.GetOrCreate(i * 7) != -i * 7)
         {
             throw new Exception("An invalid result was got.");
         }
     }
 }
Пример #2
0
        private static void _SlowSomeCollisionsForEach(int threadIndex, IGetOrCreateValueSample sample)
        {
            int multiplier = _COUNT_MANY_THREADS;

            for (long i = 0; i < _iterationsFor3Milliseconds; i++)
            {
                int value = (int)i * threadIndex;
                if (sample.GetOrCreate(value) != -value)
                {
                    throw new Exception("An invalid result was got.");
                }
            }
        }
Пример #3
0
        private static void _FastNonCollidingForEach(int threadIndex, IGetOrCreateValueSample sample)
        {
            int min = threadIndex * _COUNT_ITERATIONS_FASTCREATOR;
            int max = min + _COUNT_ITERATIONS_FASTCREATOR;

            for (int i = min; i < max; i++)
            {
                if (sample.GetOrCreate(i) != -i)
                {
                    throw new Exception("An invalid result was got.");
                }
            }
        }
Пример #4
0
        private static void _SlowSomeCollisionsForEach(int threadIndex, IGetOrCreateValueSample sample)
        {
            int multiplier = _COUNT_MANY_THREADS;

            for(long i=0; i<_iterationsFor3Milliseconds; i++)
            {
                int value = (int)i*threadIndex;
                if (sample.GetOrCreate(value) != -value)
                    throw new Exception("An invalid result was got.");
            }
        }
Пример #5
0
        private static void _FastNonCollidingForEach(int threadIndex, IGetOrCreateValueSample sample)
        {
            int min = threadIndex * _COUNT_ITERATIONS_FASTCREATOR;
            int max = min + _COUNT_ITERATIONS_FASTCREATOR;

            for(int i=min; i<max; i++)
            {
                if (sample.GetOrCreate(i) != -i)
                    throw new Exception("An invalid result was got.");
            }
        }
Пример #6
0
 private static void _FastForEach(int threadIndex, IGetOrCreateValueSample sample)
 {
     for(int i=0; i<_COUNT_ITERATIONS_FASTCREATOR; i++)
         if (sample.GetOrCreate(i*7) != -i*7)
             throw new Exception("An invalid result was got.");
 }