Lines Matching refs:keys
129 void read_keys(std::istream *input, std::vector<Key> *keys) { in read_keys() argument
146 keys->push_back(key); in read_keys()
151 std::vector<Key> *keys) { in read_keys() argument
153 read_keys(&std::cin, keys); in read_keys()
162 read_keys(&input_file, keys); in read_keys()
164 std::cout << "#keys: " << keys->size() << std::endl; in read_keys()
166 for (std::size_t i = 0; i < keys->size(); ++i) { in read_keys()
167 total_length += (*keys)[i].first.length(); in read_keys()
173 void benchmark_build(const std::vector<Key> &keys, int num_tries, in benchmark_build() argument
176 trie->build(keys, key_ids, num_tries in benchmark_build()
180 print_time_info(keys.size(), cl.elasped()); in benchmark_build()
184 const std::vector<Key> &keys, in benchmark_restore() argument
191 if (key != keys[i].first) { in benchmark_restore()
200 const std::vector<Key> &keys, in benchmark_lookup() argument
203 for (std::size_t i = 0; i < keys.size(); ++i) { in benchmark_lookup()
204 const marisa_alpha::UInt32 key_id = trie.lookup(keys[i].first); in benchmark_lookup()
210 print_time_info(keys.size(), cl.elasped()); in benchmark_lookup()
214 const std::vector<Key> &keys, in benchmark_find() argument
218 for (std::size_t i = 0; i < keys.size(); ++i) { in benchmark_find()
220 const std::size_t num_keys = trie.find(keys[i].first, &found_key_ids); in benchmark_find()
226 print_time_info(keys.size(), cl.elasped()); in benchmark_find()
230 const std::vector<Key> &keys, in benchmark_predict_breadth_first() argument
237 for (std::size_t i = 0; i < keys.size(); ++i) { in benchmark_predict_breadth_first()
241 keys[i].first, &found_key_ids, found_keys_ref); in benchmark_predict_breadth_first()
247 print_time_info(keys.size(), cl.elasped()); in benchmark_predict_breadth_first()
251 const std::vector<Key> &keys, in benchmark_predict_depth_first() argument
258 for (std::size_t i = 0; i < keys.size(); ++i) { in benchmark_predict_depth_first()
262 keys[i].first, &found_key_ids, found_keys_ref); in benchmark_predict_depth_first()
268 print_time_info(keys.size(), cl.elasped()); in benchmark_predict_depth_first()
271 void benchmark(const std::vector<Key> &keys, int num_tries) { in benchmark() argument
275 benchmark_build(keys, num_tries, &trie, &key_ids); in benchmark()
277 benchmark_restore(trie, keys, key_ids); in benchmark()
278 benchmark_lookup(trie, keys, key_ids); in benchmark()
279 benchmark_find(trie, keys, key_ids); in benchmark()
280 benchmark_predict_breadth_first(trie, keys, key_ids); in benchmark()
281 benchmark_predict_depth_first(trie, keys, key_ids); in benchmark()
287 std::vector<Key> keys; in benchmark() local
288 const int ret = read_keys(args, num_args, &keys); in benchmark()
310 benchmark(keys, i); in benchmark()