WebKit Bugzilla
Attachment 357902 Details for
Bug 192943
: Moving non-critical initializations to a parallel thread can speed up process launch time by 15%.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192943-20181220165929.patch (text/plain), 5.42 KB, created by
Suresh Koppisetty
on 2018-12-20 16:59:30 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Suresh Koppisetty
Created:
2018-12-20 16:59:30 PST
Size:
5.42 KB
patch
obsolete
>Subversion Revision: 239477 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 127c0131ef2b7cb3b210470f93f284e5429bda06..0b7f98b7fa58b372515608e84055718ba057f59d 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,53 @@ >+2018-12-20 Suresh Koppisetty <skoppisetty@apple.com> >+ >+ Moving non-critical initializations to a parallel thread can speed up process launch time by 15%. >+ https://bugs.webkit.org/show_bug.cgi?id=192943 >+ <rdar://problem/46877677>. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ _RegisterApplication, _LSSetApplicationInformationItem and _accessibilityInitialize are non-critical work >+ and they can be done in a parallel thread to speed up process launch time. Following times are measured >+ from artraces captured under different scenarios. See <rdar://problem/46877677>. >+ >+ System Config: >+ âââââââââââââ >+ MacBook Pro (13-inch, Late 2013 model running 18E158) >+ >+ Clean system: >+ âââââââââââââ >+ Mean total process launch time: 166.56 ms >+ Mean Process Launch time: 58.88 ms >+ Mean Init New Web Process time: 74.64 ms >+ >+ Root with a clean trunk: >+ âââââââââââââ >+ Safari : 32656d6f >+ Webkit: r239297 >+ >+ Mean total process launch time: 176.53 ms >+ Mean Process Launch time: 62.72 ms >+ Mean Init New Web Process time: 83.6 ms >+ >+ Root with proposed changes on top of trunk: >+ âââââââââââââ >+ Safari : 32656d6f >+ Webkit: r239297 >+ >+ Mean total process launch time: 150.12 ms >+ Mean Process Launch time: 64.19 ms >+ Mean Init New Web Process time: 74.18 ms >+ >+ Perf Improvement: >+ âââââââââââââ >+ 176.53 - 150.12 = 26.41 ms (~15%) >+ >+ * WebProcess/WebProcess.h: >+ * WebProcess/cocoa/WebProcessCocoa.mm: >+ (WebKit::WebProcess::platformInitializeWebProcess): >+ (WebKit::WebProcess::updateProcessName): >+ (WebKit::WebProcess::platformInitializeProcess): >+ > 2018-12-20 Chris Dumez <cdumez@apple.com> > > Use Optional::hasValue() instead of Optional::has_value() >diff --git a/Source/WebKit/WebProcess/WebProcess.h b/Source/WebKit/WebProcess/WebProcess.h >index ad7d1d11367858639353a422d0d3f2ff20dc77f3..4e72beea9190d68ffddbfe653ab6b44f71892d92 100644 >--- a/Source/WebKit/WebProcess/WebProcess.h >+++ b/Source/WebKit/WebProcess/WebProcess.h >@@ -468,6 +468,7 @@ private: > #if PLATFORM(MAC) > std::unique_ptr<WebCore::CPUMonitor> m_cpuMonitor; > Optional<double> m_cpuLimit; >+ OSObjectPtr<dispatch_queue_t> m_internalQueue; > > enum class ProcessType { Inspector, ServiceWorker, PrewarmedWebContent, WebContent }; > ProcessType m_processType { ProcessType::WebContent }; >diff --git a/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm b/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm >index ef32528f6899cffda85207b7ad76a0c2d2fde6f1..bf7f71d3499ee8db57d63bc262c9c25388a407bb 100644 >--- a/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm >+++ b/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm >@@ -185,7 +185,10 @@ void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters&& par > #if PLATFORM(MAC) && ENABLE(WEBPROCESS_NSRUNLOOP) > // Need to initialize accessibility for VoiceOver to work when the WebContent process is using NSRunLoop. > // Currently, it is also needed to allocate and initialize an NSApplication object. >- [NSApplication _accessibilityInitialize]; >+ dispatch_async(m_internalQueue.get(), ^{ >+ // _accessibilityInitialize would have to use the same (serial) queue as _RegisterApplication(), otherwise, _accessibilityInitialize can also end up calling _RegisterApplication. >+ [NSApplication _accessibilityInitialize]; >+ }); > #endif > > #if TARGET_OS_IPHONE >@@ -235,8 +238,8 @@ void WebProcess::updateProcessName() > break; > } > >- dispatch_async(dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0), ^{ >- // Note that it is important for _RegisterApplication() to have been called before setting the display name. >+ dispatch_async(m_internalQueue.get(), ^{ >+ // _LSSetApplicationInformationItem would have to use the same (serial) queue as _RegisterApplication(), otherwise, the call to _RegisterApplication() may happen *after* we've tried to set the process name and setting the process name would fail. > auto error = _LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), _kLSDisplayNameKey, (CFStringRef)applicationName, nullptr); > ASSERT(!error); > if (error) { >@@ -362,9 +365,14 @@ void WebProcess::platformInitializeProcess(const ChildProcessInitializationParam > > SwitchingGPUClient::setSingleton(WebSwitchingGPUClient::singleton()); > >- // This is necessary so that we are able to set the process' display name. >- _RegisterApplication(nullptr, nullptr); >+ dispatch_queue_attr_t attr = DISPATCH_QUEUE_SERIAL; >+ attr = dispatch_queue_attr_make_with_qos_class(attr, QOS_CLASS_BACKGROUND, 0); >+ m_internalQueue = adoptOSObject(dispatch_queue_create("com.apple.WebKit.WebProcessCocoa", attr)); > >+ dispatch_async(m_internalQueue.get(), ^{ >+ // This is necessary so that we are able to set the process' display name. >+ _RegisterApplication(nullptr, nullptr); >+ }); > #else > > if (![NSApp isRunning]) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192943
:
357845
|
357860
|
357870
| 357902 |
357915