protected void RunButton_OnClick(object sender, EventArgs e)
        {
            int prefixSetSize;
            if (!int.TryParse(PrefixSetSizeTextBox.Text, out prefixSetSize))
            {
                prefixSetSize = 10;
                PrefixSetSizeTextBox.Text = "10";
            }

            int testSetSize;
            if (!int.TryParse(TestSetSizeTextBox.Text, out testSetSize))
            {
                testSetSize = 1000;
                TestSetSizeTextBox.Text = "1000";
            }

            var list = new PrefixList();
            var trie = new PrefixTrie();

            var prefixes = GeneratePrefixes(prefixSetSize).ToArray();
            list.InsertRange(prefixes);
            trie.InsertRange(prefixes);

            var testData = GenerateTestData(testSetSize).ToArray();
            ListTime = TimeTest(list.ContainsPrefix, testData);
            TrieTime = TimeTest(trie.ContainsPrefix, testData);
        }
示例#2
0
        protected void RunButton_OnClick(object sender, EventArgs e)
        {
            int prefixSetSize;

            if (!int.TryParse(PrefixSetSizeTextBox.Text, out prefixSetSize))
            {
                prefixSetSize             = 10;
                PrefixSetSizeTextBox.Text = "10";
            }

            int testSetSize;

            if (!int.TryParse(TestSetSizeTextBox.Text, out testSetSize))
            {
                testSetSize             = 1000;
                TestSetSizeTextBox.Text = "1000";
            }

            var list = new PrefixList();
            var trie = new PrefixTrie();

            var prefixes = GeneratePrefixes(prefixSetSize).ToArray();

            list.InsertRange(prefixes);
            trie.InsertRange(prefixes);

            var testData = GenerateTestData(testSetSize).ToArray();

            ListTime = TimeTest(list.ContainsPrefix, testData);
            TrieTime = TimeTest(trie.ContainsPrefix, testData);
        }