New issue
Advanced search Search tips

Issue 847237 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

extensions::ChromeExtensionsClient::Initialize is 10% of renderer startup time

Project Member Reported by pdr@chromium.org, May 28 2018

Issue description

Chrome Version: 68/Canary
OS: Windows

Looking at real-world sampling of startup time, 10% of the renderer seems to be in extension initialization:
https://uma.googleplex.com/p/chrome/callstacks?sid=847440b4cd728ba6ade74a90b401f1c3

In particular, RegisterCommonManifestHandlers and RegisterChromeManifestHandlers seem to be about 7% of the total renderer time.

This seems like an easy opportunity for optimization.
 
Cc: -rdevlin....@chromium.org pdr@chromium.org
Owner: rdevlin....@chromium.org
Status: Assigned (was: Untriaged)
This sounds like fun!  Thanks for filing, pdr@.

Does this need to remain restricted?

Comment 2 by pdr@chromium.org, May 29 2018

Labels: -Restrict-View-Google
No need for RVG.
Cc: rdevlin....@chromium.org
Owner: dbertoni@chromium.org
passing to dbertoni@.
After filing this bug I learned that these metrics are a little suspect because V8 is not included (tracking bug:  crbug.com/788808 ). That said, extensions::ChromeExtensionsClient::Initialize is still a big part of renderer startup.
Yep, just looking at the code, dbertoni@ and I found a bit of low-hanging fruit that would be useful to clean up.
Project Member

Comment 6 by bugdroid1@chromium.org, Jul 24

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4562897418ad4153fd1d074e98bdcf5150c037e3

commit 4562897418ad4153fd1d074e98bdcf5150c037e3
Author: Devlin Cronin <rdevlin.cronin@chromium.org>
Date: Tue Jul 24 22:00:39 2018

[Extensions] Add UMA for extensions client initialization time

It seems that ChromeExtensionsClient::Init() is taking a non-trivial
amount of time (see linked bug). Add UMA so that we can track it,
and measure any future improvements.

Bug: 847237
Change-Id: I1b86dd9a8f2a7500841f253580a9e6d64c9f4d45
Reviewed-on: https://chromium-review.googlesource.com/1142617
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577700}
[modify] https://crrev.com/4562897418ad4153fd1d074e98bdcf5150c037e3/chrome/common/extensions/chrome_extensions_client.cc
[modify] https://crrev.com/4562897418ad4153fd1d074e98bdcf5150c037e3/tools/metrics/histograms/histograms.xml

Project Member

Comment 7 by bugdroid1@chromium.org, Aug 15

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c041689fbae30d181389f45a3e7b67240e7e79f5

commit c041689fbae30d181389f45a3e7b67240e7e79f5
Author: David Bertoni <dbertoni@chromium.org>
Date: Wed Aug 15 00:07:20 2018

[EXTENSIONS] Use small_map instead of std::map for the manifest handler registry.

Add a perf unit test and a unit test to make sure the small_map doesn't overflow.

Bug: 847237
Change-Id: I56bd58b75dacf42abb32b6ce091e5930ceebd203
Reviewed-on: https://chromium-review.googlesource.com/1166190
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583094}
[modify] https://crrev.com/c041689fbae30d181389f45a3e7b67240e7e79f5/chrome/common/extensions/chrome_extensions_client_unittest.cc
[modify] https://crrev.com/c041689fbae30d181389f45a3e7b67240e7e79f5/extensions/common/BUILD.gn
[modify] https://crrev.com/c041689fbae30d181389f45a3e7b67240e7e79f5/extensions/common/manifest_handler.cc
[modify] https://crrev.com/c041689fbae30d181389f45a3e7b67240e7e79f5/extensions/common/manifest_handler.h
[add] https://crrev.com/c041689fbae30d181389f45a3e7b67240e7e79f5/extensions/common/manifest_handler_perf_test.cc

Project Member

Comment 8 by bugdroid1@chromium.org, Sep 5

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/88a71c1882a35fa447cfd2cab3bd72e37bfe1c45

commit 88a71c1882a35fa447cfd2cab3bd72e37bfe1c45
Author: David Bertoni <dbertoni@chromium.org>
Date: Wed Sep 05 01:35:55 2018

[Extensions] Use vector instead of set for sorting handlers.

ManfestHandlerRegistry::SortManifestHandlers() uses std::set to hold pointers
to the unsorted handlers while it's building the priority map of handlers.
This about 6x slower than just putting the pointers into a vector and there
is no need for any of the properties of std::set (fast key lookup, uniqueness).

Bug: 847237
Change-Id: Ia55b53de929fb7ee782e36be5b4002bc988da4c9
Reviewed-on: https://chromium-review.googlesource.com/1204604
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588733}
[modify] https://crrev.com/88a71c1882a35fa447cfd2cab3bd72e37bfe1c45/extensions/common/manifest_handler.cc
[modify] https://crrev.com/88a71c1882a35fa447cfd2cab3bd72e37bfe1c45/extensions/common/manifest_handler.h
[modify] https://crrev.com/88a71c1882a35fa447cfd2cab3bd72e37bfe1c45/extensions/common/manifest_handler_perf_test.cc

Project Member

Comment 9 by bugdroid1@chromium.org, Sep 11

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/45885f643ee5b3b54c3d970158f4578ca17891fe

commit 45885f643ee5b3b54c3d970158f4578ca17891fe
Author: David Bertoni <dbertoni@chromium.org>
Date: Tue Sep 11 23:48:49 2018

[Extensions] Change initialization timer stat to microseconds.

This also fixes bugs caused by revisions 489ad84c3741e27371c4509c49a94061e8ae83cf and e3e9da53e8b90f82b39872b02fd0dc3e8315c09e, which moved functionality out of the code path.

Bug: 847237
Change-Id: Ib60046f52b19d510e1f838a9900c1074b62d8c68
Reviewed-on: https://chromium-review.googlesource.com/1217910
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590534}
[modify] https://crrev.com/45885f643ee5b3b54c3d970158f4578ca17891fe/chrome/common/extensions/chrome_extensions_client.cc
[modify] https://crrev.com/45885f643ee5b3b54c3d970158f4578ca17891fe/extensions/common/extensions_client.cc
[modify] https://crrev.com/45885f643ee5b3b54c3d970158f4578ca17891fe/tools/metrics/histograms/histograms.xml

Project Member

Comment 10 by bugdroid1@chromium.org, Sep 17

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/df802678ea444e5471e3cf75ef5dec8b75548fa3

commit df802678ea444e5471e3cf75ef5dec8b75548fa3
Author: Devlin Cronin <rdevlin.cronin@chromium.org>
Date: Mon Sep 17 23:33:57 2018

[Extensions] Clean up API Permission Registration

Clean up API Permission registration to happen directly in the
ExtensionAPIProviders, rather than through a separate
PermissionsProvider class (though the permissions are still defined in
the old file).  Permissions are now registered by passing a base::span
of APIPermissionInfo::InitInfos to the PermissionsInfo. Also combine
alias definition in the same file.
This has a number of advantages:
- Less code (getting rid of PermissionsProvider, which didn't really add
  much, and get rid of the separate aliases file).
- Avoid constructing a vector or each call to
  PermissionsProvider::GetAllPermissions(). base::spans are cheaper to
  construct.
- Make all the c-style arrays of APIPermissionInfo::InitInfos static.
  Avoid reconstructing them. (In practice, this doesn't matter, since
  these methods should only be called once per process, but it makes it
  guaranteed should anything change.)

This might have a slight improvement on ExtensionsClient init time
(since we save on vector construction), but mostly just to simplify
things.

Bug: 847237

Change-Id: I4e161f899a0b3b9ac816c130222db6ea462ddcc3
Reviewed-on: https://chromium-review.googlesource.com/1225211
Reviewed-by: Luke Halliwell <halliwell@chromium.org>
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#591875}
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/chrome/browser/extensions/permissions_based_management_policy_provider_unittest.cc
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/chrome/common/BUILD.gn
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/chrome/common/apps/platform_apps/chrome_apps_api_permissions.cc
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/chrome/common/apps/platform_apps/chrome_apps_api_permissions.h
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/chrome/common/apps/platform_apps/chrome_apps_api_provider.cc
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/chrome/common/apps/platform_apps/chrome_apps_api_provider.h
[delete] https://crrev.com/059b37110ad2d6dcd3c177b66f26bbfdfe197386/chrome/common/extensions/chrome_aliases.cc
[delete] https://crrev.com/059b37110ad2d6dcd3c177b66f26bbfdfe197386/chrome/common/extensions/chrome_aliases.h
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/chrome/common/extensions/chrome_extensions_api_provider.cc
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/chrome/common/extensions/chrome_extensions_api_provider.h
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/chrome/common/extensions/permissions/chrome_api_permissions.cc
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/chrome/common/extensions/permissions/chrome_api_permissions.h
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/chromecast/common/BUILD.gn
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/chromecast/common/cast_extensions_api_provider.cc
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/chromecast/common/cast_extensions_api_provider.h
[delete] https://crrev.com/059b37110ad2d6dcd3c177b66f26bbfdfe197386/chromecast/common/extensions_api/cast_aliases.cc
[delete] https://crrev.com/059b37110ad2d6dcd3c177b66f26bbfdfe197386/chromecast/common/extensions_api/cast_aliases.h
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/chromecast/common/extensions_api/cast_api_permissions.cc
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/chromecast/common/extensions_api/cast_api_permissions.h
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/extensions/common/BUILD.gn
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/extensions/common/core_extensions_api_provider.cc
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/extensions/common/core_extensions_api_provider.h
[delete] https://crrev.com/059b37110ad2d6dcd3c177b66f26bbfdfe197386/extensions/common/extensions_aliases.cc
[delete] https://crrev.com/059b37110ad2d6dcd3c177b66f26bbfdfe197386/extensions/common/extensions_aliases.h
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/extensions/common/extensions_api_provider.h
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/extensions/common/extensions_client.cc
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/extensions/common/permissions/api_permission.h
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/extensions/common/permissions/extensions_api_permissions.cc
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/extensions/common/permissions/extensions_api_permissions.h
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/extensions/common/permissions/permissions_info.cc
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/extensions/common/permissions/permissions_info.h
[delete] https://crrev.com/059b37110ad2d6dcd3c177b66f26bbfdfe197386/extensions/common/permissions/permissions_provider.h
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/extensions/shell/common/shell_extensions_api_provider.cc
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/extensions/shell/common/shell_extensions_api_provider.h
[modify] https://crrev.com/df802678ea444e5471e3cf75ef5dec8b75548fa3/extensions/shell/common/shell_extensions_client.cc

Project Member

Comment 11 by bugdroid1@chromium.org, Sep 27

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/eaaabb6bdec758c16d0689c99b3926f3ccb67fa3

commit eaaabb6bdec758c16d0689c99b3926f3ccb67fa3
Author: David Bertoni <dbertoni@chromium.org>
Date: Thu Sep 27 00:31:56 2018

[Extensions] Changed PermissionsInfo::IDMap to use unordered_map.

Bug: 847237
Change-Id: I4718a8ea2d4b6d2b74d632f06f614dd042f04a07
Reviewed-on: https://chromium-review.googlesource.com/1246941
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594536}
[modify] https://crrev.com/eaaabb6bdec758c16d0689c99b3926f3ccb67fa3/extensions/common/permissions/permissions_info.h

Project Member

Comment 12 by bugdroid1@chromium.org, Sep 27

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e83fe9163009ce586ab19d02aa6451f202fd61ea

commit e83fe9163009ce586ab19d02aa6451f202fd61ea
Author: David Bertoni <dbertoni@chromium.org>
Date: Thu Sep 27 18:32:29 2018

[Extensions] Convert vector of Alias(es) to base::span in API.

Bug: 847237
Change-Id: Ia95ec62d92a31bc5c71d53c355b6cb577acb4350
Reviewed-on: https://chromium-review.googlesource.com/1244099
Reviewed-by: Trent Apted <tapted@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594794}
[modify] https://crrev.com/e83fe9163009ce586ab19d02aa6451f202fd61ea/chrome/common/apps/platform_apps/chrome_apps_api_provider.cc
[modify] https://crrev.com/e83fe9163009ce586ab19d02aa6451f202fd61ea/chrome/common/extensions/permissions/chrome_api_permissions.cc
[modify] https://crrev.com/e83fe9163009ce586ab19d02aa6451f202fd61ea/chrome/common/extensions/permissions/chrome_api_permissions.h
[modify] https://crrev.com/e83fe9163009ce586ab19d02aa6451f202fd61ea/extensions/common/alias.h
[modify] https://crrev.com/e83fe9163009ce586ab19d02aa6451f202fd61ea/extensions/common/permissions/extensions_api_permissions.cc
[modify] https://crrev.com/e83fe9163009ce586ab19d02aa6451f202fd61ea/extensions/common/permissions/extensions_api_permissions.h
[modify] https://crrev.com/e83fe9163009ce586ab19d02aa6451f202fd61ea/extensions/common/permissions/permissions_info.cc
[modify] https://crrev.com/e83fe9163009ce586ab19d02aa6451f202fd61ea/extensions/common/permissions/permissions_info.h

Sign in to add a comment