New issue
Advanced search Search tips

Issue 604848 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Apr 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

Optimize URLPrefix::BestURLPrefix

Project Member Reported by a-...@yandex-team.ru, Apr 19 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.91 YaBrowser/16.4.0.6108 (beta) Safari/537.36

Steps to reproduce the problem:
URLPrefix::BestURLPrefix is function that is used in HistoryQuickProvider in history score calculation. It is called from ScoredHistoryMatch constructor for every HQP url candidate. 
Current implementation is not very effective and can take as much as 25% of HQP cpu time on average history as shown on screenshot from profiler. 
BestURLPrefix tries to match input url with several url prefixes and in the process of matching, it performs a lot of redundant lowercase conversions of input text and prefix.

What is the expected behavior?

What went wrong?
URLPrefix::BestURLPrefix is slower than it could be.

Did this work before? N/A 

Chrome version: 49.0.2623.91  Channel: n/a
OS Version: OS X 10.10.4
Flash Version: Shockwave Flash 21.0 r0
 
I tried to optimize BestURLPrefix and have lowered its cpu usage to ~7% of HQP. I think this change  can lower HQP Query time by 10-15%.
Please take a look at code, feel free to comment.
before_prefix_optimization.png
903 KB View Download
after_prefix_optimization.png
909 KB View Download
That looks great! Can you upload a patch with your optimization?
Components: -UI UI>Browser>History
Labels: Performance
Status: Available (was: Unconfirmed)
Created change request https://codereview.chromium.org/1897403002.
Project Member

Comment 6 by bugdroid1@chromium.org, Apr 25 2016

Components: UI>Browser>Omnibox
FYI, this change went out with canary 52.0.2716.0.  I can clearly see the improvement in the UMA graphs.  For example, the time it takes the omnibox to become responsive when the user types the first character in the omnibox (this is usually the slowest time of all, as it matches so much history) (histogram Omnibox.QueryTime2.1) has dropped about 30%.

Nice work!

Probably time to mark this bug as fixed (unless you have further improvement ideas).
For the record, Omnibox.ProviderTime2.HistoryQuick is down similarly (~20%) at the 95th percentile and Omnibox.CharTypedToRepaintLatency is down ~15% at the 95th percentile.  In other words, this small-scoped change moved all the metrics in a noticeable way.
I am glad that this changes are useful. 
You can close this bug. I will create another when I have new ideas.

BTW, I have created a sort of perftest to check impact of my changes. It is based on a HQP unittest and uses my History file to initialize HQP. After that I run different input queries on HQP several times. Do you think it is useful to add such test to chromium perftests? One that uses already filled History DB? 
Also I wanted to ask - do you use any perftests to measure providers performance? Or only data from histograms after changes are rolled out to canary?
Cc: sullivan@chromium.org
Status: Fixed (was: Available)
Marking as fixed. Your perftest sounds like a good idea. I believe you can add new ones by adding to //tools/perf/benchmarks.

+sullivan@ in case I'm wrong, I've never added one before.
You can create unit-test-style perftests in the style of cc_perftests. Here's an example CL that adds some to the perf waterfall: https://codereview.chromium.org/962863002/

The big thing to remember is that every perf test needs an owner--someone we can cc on regressions and breakages if we can't figure out the problem.
>>>
Also I wanted to ask - do you use any perftests to measure providers performance? Or only data from histograms after changes are rolled out to canary?
>>>
I am not aware of any perftests that measure omnibox provider performance (or even omnibox performance in general).


Sign in to add a comment