Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(815)

Side by Side Diff: components/omnibox/browser/url_index_private_data.cc

Issue 2300323003: Adding performance tests for HQP that represent importance of optimising HistoryItemsForTerms method (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/omnibox/browser/url_index_private_data.h" 5 #include "components/omnibox/browser/url_index_private_data.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <functional> 9 #include <functional>
10 #include <iterator> 10 #include <iterator>
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 word_id_history_map_.clear(); 515 word_id_history_map_.clear();
516 history_id_word_map_.clear(); 516 history_id_word_map_.clear();
517 history_info_map_.clear(); 517 history_info_map_.clear();
518 word_starts_map_.clear(); 518 word_starts_map_.clear();
519 } 519 }
520 520
521 URLIndexPrivateData::~URLIndexPrivateData() {} 521 URLIndexPrivateData::~URLIndexPrivateData() {}
522 522
523 HistoryIDSet URLIndexPrivateData::HistoryIDSetFromWords( 523 HistoryIDSet URLIndexPrivateData::HistoryIDSetFromWords(
524 const String16Vector& unsorted_words) { 524 const String16Vector& unsorted_words) {
525 SCOPED_UMA_HISTOGRAM_TIMER("Omnibox.HistoryIDSetFromWords");
525 // Break the terms down into individual terms (words), get the candidate 526 // Break the terms down into individual terms (words), get the candidate
526 // set for each term, and intersect each to get a final candidate list. 527 // set for each term, and intersect each to get a final candidate list.
527 // Note that a single 'term' from the user's perspective might be 528 // Note that a single 'term' from the user's perspective might be
528 // a string like "http://www.somewebsite.com" which, from our perspective, 529 // a string like "http://www.somewebsite.com" which, from our perspective,
529 // is four words: 'http', 'www', 'somewebsite', and 'com'. 530 // is four words: 'http', 'www', 'somewebsite', and 'com'.
530 HistoryIDSet history_id_set; 531 HistoryIDSet history_id_set;
531 String16Vector words(unsorted_words); 532 String16Vector words(unsorted_words);
532 // Sort the words into the longest first as such are likely to narrow down 533 // Sort the words into the longest first as such are likely to narrow down
533 // the results quicker. Also, single character words are the most expensive 534 // the results quicker. Also, single character words are the most expensive
534 // to process so save them for last. 535 // to process so save them for last.
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 // First cut: typed count, visit count, recency. 1355 // First cut: typed count, visit count, recency.
1355 // TODO(mrossetti): This is too simplistic. Consider an approach which ranks 1356 // TODO(mrossetti): This is too simplistic. Consider an approach which ranks
1356 // recently visited (within the last 12/24 hours) as highly important. Get 1357 // recently visited (within the last 12/24 hours) as highly important. Get
1357 // input from mpearson. 1358 // input from mpearson.
1358 if (r1.typed_count() != r2.typed_count()) 1359 if (r1.typed_count() != r2.typed_count())
1359 return (r1.typed_count() > r2.typed_count()); 1360 return (r1.typed_count() > r2.typed_count());
1360 if (r1.visit_count() != r2.visit_count()) 1361 if (r1.visit_count() != r2.visit_count())
1361 return (r1.visit_count() > r2.visit_count()); 1362 return (r1.visit_count() > r2.visit_count());
1362 return (r1.last_visit() > r2.last_visit()); 1363 return (r1.last_visit() > r2.last_visit());
1363 } 1364 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698