RESOLVED FIXED 184904
dlopen the bundle's executable before calling -[NSBundle load] since that will also do a bunch of other things we don't need
https://bugs.webkit.org/show_bug.cgi?id=184904
Summary dlopen the bundle's executable before calling -[NSBundle load] since that wil...
Saam Barati
Reported 2018-04-23 18:29:46 PDT
...
Attachments
WIP (2.62 KB, patch)
2018-04-23 18:35 PDT, Saam Barati
no flags
patch (4.20 KB, patch)
2018-04-24 18:00 PDT, Saam Barati
ggaren: review+
patch for landing (4.19 KB, patch)
2018-04-25 19:49 PDT, Saam Barati
no flags
Saam Barati
Comment 1 2018-04-23 18:35:12 PDT
Created attachment 338627 [details] WIP Seems to work at least with Safari. I'm going to do some perf testing both for when it succeeds and when it fails. I want to make sure the second dlopen that NSBundle does inside [NSBundle load] when the dlsym fails is essentially a no-op.
EWS Watchlist
Comment 2 2018-04-23 18:46:02 PDT
Attachment 338627 [details] did not pass style-queue: ERROR: Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:37: Alphabetical sorting problem. [build/include_order] [4] ERROR: Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:44: Alphabetical sorting problem. [build/include_order] [4] ERROR: Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:103: Should have a space between // and comment [whitespace/comments] [4] ERROR: Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:107: Should have a space between // and comment [whitespace/comments] [4] ERROR: Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:110: Should have a space between // and comment [whitespace/comments] [4] Total errors found: 5 in 1 files If any of these errors are false positives, please file a bug against check-webkit-style.
Saam Barati
Comment 3 2018-04-24 17:32:48 PDT
Doing this speeds up initializeWebProcess by ~60ms on my MBP.
Saam Barati
Comment 4 2018-04-24 17:44:17 PDT
(In reply to Saam Barati from comment #3) > Doing this speeds up initializeWebProcess by ~60ms on my MBP. Actually more around ~70ms.
Saam Barati
Comment 5 2018-04-24 18:00:40 PDT
Saam Barati
Comment 6 2018-04-24 18:01:02 PDT
Comment on attachment 338692 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=338692&action=review > Source/WebKit/ChangeLog:19 > + This speeds up initializeWebProcess by ~70ms on my MBP. This speeds up initializeWebProcess on my MBP by close to 2x.
Geoffrey Garen
Comment 7 2018-04-25 13:09:01 PDT
Comment on attachment 338692 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=338692&action=review r=me > Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:94 > + if (!dlopenHandle || !initializeFunction) { I think it's better just to check !initializeFunction here and below, and to scope dlopenHandle to inside the if block. Logically, we want to fall back if we didn't find the initialize function, regardless of why we didn't find it -- and if we did find it, we don't need to fall back and we don't care about other details.
Saam Barati
Comment 8 2018-04-25 13:17:31 PDT
Comment on attachment 338692 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=338692&action=review >> Source/WebKit/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:94 >> + if (!dlopenHandle || !initializeFunction) { > > I think it's better just to check !initializeFunction here and below, and to scope dlopenHandle to inside the if block. > > Logically, we want to fall back if we didn't find the initialize function, regardless of why we didn't find it -- and if we did find it, we don't need to fall back and we don't care about other details. Sounds good. The way I do it now just saves us from an extraneous dlsym. But that's probably ok.
Saam Barati
Comment 9 2018-04-25 19:49:11 PDT
Created attachment 338850 [details] patch for landing
WebKit Commit Bot
Comment 10 2018-04-25 20:34:04 PDT
Comment on attachment 338850 [details] patch for landing Clearing flags on attachment: 338850 Committed r231041: <https://trac.webkit.org/changeset/231041>
WebKit Commit Bot
Comment 11 2018-04-25 20:34:05 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 12 2018-04-25 20:35:32 PDT
Note You need to log in before you can comment on or make changes to this bug.