public void Setup()
        {
            _strings  = GetStrings(100);
            _segments = new PathSegment[100];

            for (var i = 0; i < _strings.Length; i++)
            {
                _segments[i] = new PathSegment(0, _strings[i].Length);
            }

            var samples = new int[Count];

            for (var i = 0; i < samples.Length; i++)
            {
                samples[i] = i * (_strings.Length / Count);
            }

            var entries = new List <(string text, int _)>();

            for (var i = 0; i < samples.Length; i++)
            {
                entries.Add((_strings[samples[i]], i));
            }

            _linearSearch = new LinearSearchJumpTable(0, -1, entries.ToArray());
            _dictionary   = new DictionaryJumpTable(0, -1, entries.ToArray());
            _trie         = new ILEmitTrieJumpTable(0, -1, entries.ToArray(), vectorize: false, _dictionary);
            _vectorTrie   = new ILEmitTrieJumpTable(0, -1, entries.ToArray(), vectorize: true, _dictionary);
        }
Exemple #2
0
 public DfaState(
     Candidate[] candidates,
     IEndpointSelectorPolicy[] policies,
     JumpTable pathTransitions,
     PolicyJumpTable policyTransitions)
 {
     Candidates        = candidates;
     Policies          = policies;
     PathTransitions   = pathTransitions;
     PolicyTransitions = policyTransitions;
 }
Exemple #3
0
 public void Setup()
 {
     _table   = new ZeroEntryJumpTable(0, -1);
     _strings = new string[]
     {
         "index/foo/2",
         "index/hello-world1/2",
         "index/hello-world/2",
         "index//2",
         "index/hillo-goodbye/2",
     };
     _segments = new PathSegment[]
     {
         new PathSegment(6, 3),
         new PathSegment(6, 12),
         new PathSegment(6, 11),
         new PathSegment(6, 0),
         new PathSegment(6, 13),
     };
 }
 public void Setup()
 {
     _default    = new SingleEntryJumpTable(0, -1, "hello-world", 1);
     _trie       = new ILEmitTrieJumpTable(0, -1, new[] { ("hello-world", 1), }, vectorize: false, _default);