Bug 185951

Summary: Some of the work in initializeLogChannelsIfNecessary() is unnecessary for release builds
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebCore Misc.Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, ggaren, krollin, rniwa, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Chris Dumez 2018-05-24 10:08:30 PDT
Some of the work in initializeLogChannelsIfNecessary() is unnecessary for release builds and slows down launch time. In particular, it is unnecessary to read NSDefaults to figure out which logging channels should be enabled.
Comment 1 Chris Dumez 2018-05-24 10:17:26 PDT
Sample Count, Samples %, CPU %, Symbol
17, 0.2%, 0.1%, WebKit::InitializeWebKit2() (in WebKit)
17, 0.2%, 0.1%,     std::__1::__call_once(unsigned long volatile&, void*, void (*)(void*)) (in libc++.1.dylib)
17, 0.2%, 0.1%,         WebKit::runInitializationCode(void*) (in WebKit)
11, 0.1%, 0.1%,             WebCore::initializeLogChannelsIfNecessary(std::optional<WTF::String>) (in WebCore)
6, 0.1%, 0.0%,                 WebCore::logLevelString() (in WebCore)
5, 0.1%, 0.0%,                     +[NSUserDefaults(NSUserDefaults) standardUserDefaults] (in Foundation)
5, 0.1%, 0.0%,                         -[NSUserDefaults(NSUserDefaults) init] (in Foundation)
5, 0.1%, 0.0%,                             +[NSLocale currentLocale] (in CoreFoundation)
1, 0.0%, 0.0%,                     -[NSUserDefaults(NSUserDefaults) stringForKey:] (in Foundation)
5, 0.1%, 0.0%,                 WTFInitializeLogChannelStatesFromString (in JavaScriptCore)
5, 0.1%, 0.0%,                     os_log_create (in libsystem_trace.dylib)
Comment 2 Chris Dumez 2018-05-24 10:23:47 PDT
Created attachment 341204 [details]
Patch
Comment 3 Geoffrey Garen 2018-05-24 11:39:08 PDT
Comment on attachment 341204 [details]
Patch

r=me
Comment 4 WebKit Commit Bot 2018-05-24 12:23:05 PDT
Comment on attachment 341204 [details]
Patch

Clearing flags on attachment: 341204

Committed r232158: <https://trac.webkit.org/changeset/232158>
Comment 5 WebKit Commit Bot 2018-05-24 12:23:07 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2018-05-24 12:24:21 PDT
<rdar://problem/40530243>