|
|
Created:
4 years, 2 months ago by pkalinnikov Modified:
4 years, 2 months ago CC:
chromium-reviews, cbentzel+watch_chromium.org Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionAvoid unnecessary std::string allocations.
When checking SameDomainOrHost, it is unnecessary to allocate std::string's
when retrieving DomainAndRegistry from URLs. It is actually unnecessary
elsewhere, but this can be addressed in a different CL.
BUG=655187
Committed: https://crrev.com/e0a1c1bd1456928a05a582c78210a81f8fe30859
Cr-Commit-Position: refs/heads/master@{#425111}
Patch Set 1 #
Total comments: 5
Patch Set 2 : Correct comment. #
Total comments: 2
Patch Set 3 : Remove function from the header. #Messages
Total messages: 29 (17 generated)
The CQ bit was checked by pkalinnikov@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Description was changed from ========== Avoid unnecessary std::string allocations. BUG= ========== to ========== Avoid unnecessary std::string allocations. BUG= ==========
pkalinnikov@chromium.org changed reviewers: + engedy@chromium.org
Balazs, can you take a first look?
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
LGTM % comments. Thanks for looking into this! https://codereview.chromium.org/2380523004/diff/1/net/base/registry_controlle... File net/base/registry_controlled_domains/registry_controlled_domain.h (right): https://codereview.chromium.org/2380523004/diff/1/net/base/registry_controlle... net/base/registry_controlled_domains/registry_controlled_domain.h:185: // Same as above, but returns a part of |gurl|'s host in a StringPiece. Phrasing nit: ... returns the domain and registry as a StringPiece that references the underlying string of the passed-in |gurl|. https://codereview.chromium.org/2380523004/diff/1/net/base/registry_controlle... net/base/registry_controlled_domains/registry_controlled_domain.h:186: // TODO(pkalinnikov): Rename this to GetDomainAndRegistry and get rid of the As discussed, please run some quick tests to see how often this is called during normal browsing, e.g. by adding TRACE_EVENT inside. If called often, I agree that we should file a bug documenting that fact, reference that bug here in this CL, then update all existing call sites in a follow-up CL and remove this TODO.
https://codereview.chromium.org/2380523004/diff/1/net/base/registry_controlle... File net/base/registry_controlled_domains/registry_controlled_domain.h (right): https://codereview.chromium.org/2380523004/diff/1/net/base/registry_controlle... net/base/registry_controlled_domains/registry_controlled_domain.h:185: // Same as above, but returns a part of |gurl|'s host in a StringPiece. On 2016/09/28 17:22:52, engedy wrote: > Phrasing nit: ... returns the domain and registry as a StringPiece that > references the underlying string of the passed-in |gurl|. Done. https://codereview.chromium.org/2380523004/diff/1/net/base/registry_controlle... net/base/registry_controlled_domains/registry_controlled_domain.h:186: // TODO(pkalinnikov): Rename this to GetDomainAndRegistry and get rid of the On 2016/09/28 17:22:52, engedy wrote: > As discussed, please run some quick tests to see how often this is called during > normal browsing, e.g. by adding TRACE_EVENT inside. > > If called often, I agree that we should file a bug documenting that fact, > reference that bug here in this CL, then update all existing call sites in a > follow-up CL and remove this TODO. It is used not frequently during normal browsing. In a small experiment I collected 9 calls, which was roughly the number of times I clicked some hyperlink. Can I leave the TODO?
pkalinnikov@chromium.org changed reviewers: + pkasting@chromium.org
Hi Peter, Can you please review this? Please also advise if I can attach this to any existing bug, or if I should create a new one. Thanks, Pavel
Description was changed from ========== Avoid unnecessary std::string allocations. BUG= ========== to ========== Avoid unnecessary std::string allocations. When checking SameDomainOrHost, it is unnecessary to allocate std::string's when retrieving DomainAndRegistry from URLs. It is actually unnecessary elsewhere, but this can be addressed in a different CL. BUG= ==========
Still LGTM. https://codereview.chromium.org/2380523004/diff/1/net/base/registry_controlle... File net/base/registry_controlled_domains/registry_controlled_domain.h (right): https://codereview.chromium.org/2380523004/diff/1/net/base/registry_controlle... net/base/registry_controlled_domains/registry_controlled_domain.h:186: // TODO(pkalinnikov): Rename this to GetDomainAndRegistry and get rid of the On 2016/10/05 11:51:35, pkalinnikov wrote: > On 2016/09/28 17:22:52, engedy wrote: > > As discussed, please run some quick tests to see how often this is called > during > > normal browsing, e.g. by adding TRACE_EVENT inside. > > > > If called often, I agree that we should file a bug documenting that fact, > > reference that bug here in this CL, then update all existing call sites in a > > follow-up CL and remove this TODO. > > It is used not frequently during normal browsing. In a small experiment I > collected 9 calls, which was roughly the number of times I clicked some > hyperlink. > > Can I leave the TODO? Usually it's recommended to leave a TODO only if we are actually planning to do this refactor in the near future, and in that case we should file a bug to track it. I'd leave it up to Peter to decide if the refactor is worth it in light of how rarely this is called.
LGTM with comment https://codereview.chromium.org/2380523004/diff/20001/net/base/registry_contr... File net/base/registry_controlled_domains/registry_controlled_domain.cc (right): https://codereview.chromium.org/2380523004/diff/20001/net/base/registry_contr... net/base/registry_controlled_domains/registry_controlled_domain.cc:187: base::StringPiece GetDomainAndRegistryAsStringPiece( For now, I would move this function into the anonymous namespace above and remove it from the .h, since it's not called outside the class. I'm not opposed to changing the public interface of the class to use StringPieces if it makes sense. (That would probably be better than have string and StringPiece variants of some of the functions there.) However, let's not touch the header until we're actually going to do that. If you want to pursue it, I suggest filing a bug against yourself about this and adding a TODO on this helper to eliminate it by exposing StringPiece as the interface type for all these APIs. However, StringPiece can be viral, and it would be sad to add 50 .as_string() calls in the callers if that didn't end up being a timesave.
https://codereview.chromium.org/2380523004/diff/20001/net/base/registry_contr... File net/base/registry_controlled_domains/registry_controlled_domain.cc (right): https://codereview.chromium.org/2380523004/diff/20001/net/base/registry_contr... net/base/registry_controlled_domains/registry_controlled_domain.cc:187: base::StringPiece GetDomainAndRegistryAsStringPiece( On 2016/10/06 06:21:35, Peter Kasting (OOO Oct. 6-7) wrote: > For now, I would move this function into the anonymous namespace above and > remove it from the .h, since it's not called outside the class. > > I'm not opposed to changing the public interface of the class to use > StringPieces if it makes sense. (That would probably be better than have string > and StringPiece variants of some of the functions there.) However, let's not > touch the header until we're actually going to do that. > > If you want to pursue it, I suggest filing a bug against yourself about this and > adding a TODO on this helper to eliminate it by exposing StringPiece as the > interface type for all these APIs. However, StringPiece can be viral, and it > would be sad to add 50 .as_string() calls in the callers if that didn't end up > being a timesave. Done.
Description was changed from ========== Avoid unnecessary std::string allocations. When checking SameDomainOrHost, it is unnecessary to allocate std::string's when retrieving DomainAndRegistry from URLs. It is actually unnecessary elsewhere, but this can be addressed in a different CL. BUG= ========== to ========== Avoid unnecessary std::string allocations. When checking SameDomainOrHost, it is unnecessary to allocate std::string's when retrieving DomainAndRegistry from URLs. It is actually unnecessary elsewhere, but this can be addressed in a different CL. BUG=655187 ==========
The CQ bit was checked by pkalinnikov@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Hi Peter, Does this look good? Can I submit?
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Yep, LGTM
The CQ bit was checked by pkalinnikov@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from engedy@chromium.org Link to the patchset: https://codereview.chromium.org/2380523004/#ps40001 (title: "Remove function from the header.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== Avoid unnecessary std::string allocations. When checking SameDomainOrHost, it is unnecessary to allocate std::string's when retrieving DomainAndRegistry from URLs. It is actually unnecessary elsewhere, but this can be addressed in a different CL. BUG=655187 ========== to ========== Avoid unnecessary std::string allocations. When checking SameDomainOrHost, it is unnecessary to allocate std::string's when retrieving DomainAndRegistry from URLs. It is actually unnecessary elsewhere, but this can be addressed in a different CL. BUG=655187 ==========
Message was sent while issue was closed.
Committed patchset #3 (id:40001)
Message was sent while issue was closed.
Description was changed from ========== Avoid unnecessary std::string allocations. When checking SameDomainOrHost, it is unnecessary to allocate std::string's when retrieving DomainAndRegistry from URLs. It is actually unnecessary elsewhere, but this can be addressed in a different CL. BUG=655187 ========== to ========== Avoid unnecessary std::string allocations. When checking SameDomainOrHost, it is unnecessary to allocate std::string's when retrieving DomainAndRegistry from URLs. It is actually unnecessary elsewhere, but this can be addressed in a different CL. BUG=655187 Committed: https://crrev.com/e0a1c1bd1456928a05a582c78210a81f8fe30859 Cr-Commit-Position: refs/heads/master@{#425111} ==========
Message was sent while issue was closed.
Patchset 3 (id:??) landed as https://crrev.com/e0a1c1bd1456928a05a582c78210a81f8fe30859 Cr-Commit-Position: refs/heads/master@{#425111} |