Ejemplo n.º 1
0
        public void CanBuildKeySetFastEnough()
        {
            const int count1 = 1000;
            const int count2 = 500;

            Stopwatch watch = Stopwatch.StartNew();

            ITupleKeySet keyset = CreateTupleKeySet(count1, count2);

            watch.Stop();

            Console.WriteLine(@"Building key set for {0:N0} string tuples: {1:N0} ms",
                              keyset.Count, watch.ElapsedMilliseconds);
            Assert.IsTrue(watch.ElapsedMilliseconds < 3000, "too slow");
        }
Ejemplo n.º 2
0
        public void CanCheckTupleKeySetForNonExistingTuplesFastEnough()
        {
            ITupleKeySet keyset = CreateTupleKeySet(1000, 500);

            Stopwatch watch = Stopwatch.StartNew();

            const int containsCount = 10000;

            for (int i = 0; i < containsCount; i++)
            {
                keyset.Contains(new Tuple("doesnotexist", "neither"));
            }

            watch.Stop();

            Console.WriteLine(
                @"Checking key set of {0:N0} string tuples {1:N0} times for Contains: {2:N0} ms",
                keyset.Count, containsCount, watch.ElapsedMilliseconds);

            Assert.IsTrue(watch.ElapsedMilliseconds < 1000, "too slow");
        }
Ejemplo n.º 3
0
        private void EnsureKeySet()
        {
            if (_keySet != null || _tupleKeySet != null)
            {
                return;
            }

            _whereClause = GetConstraint(_referencedTable);

            if (_usesSingleKey)
            {
                _keySet = KeySetUtils.ReadKeySet(_referencedTable, _referencedKeyFields[0],
                                                 _whereClause, _referencedKeyFieldTypes[0],
                                                 _referencedKeyFieldIndices[0]);
            }
            else
            {
                _tupleKeySet = KeySetUtils.ReadTupleKeySet(_referencedTable, _referencedKeyFields,
                                                           _whereClause, _referencedKeyFieldTypes,
                                                           _referencedKeyFieldIndices);
            }
        }