Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize / simplify slow case in StringView::convertASCIILowercaseAtom() #503

Closed
wants to merge 2 commits into from
Closed

Optimize / simplify slow case in StringView::convertASCIILowercaseAtom() #503

wants to merge 2 commits into from

Conversation

cdumez
Copy link
Contributor

@cdumez cdumez commented May 4, 2022

4c741ae

Optimize / simplify slow case in StringView::convertASCIILowercaseAtom()
https://bugs.webkit.org/show_bug.cgi?id=240082

Reviewed by NOBODY (OOPS!).

Optimize / simplify slow case in StringView::convertASCIILowercaseAtom() where the input string
is not already lowercase. We now call `makeAtomString(lowercase(input))` which simplifies the
code a lot and is actually more efficient because makeAtomString() has an optimization that
avoids a StringImpl allocation when the string is relatively small (< 64 characters) and is
already part of the AtomStringTable already.

I validated the implementation by running it in a loop with the String "BODY" and got a
~35% speedup.

* Source/WTF/wtf/text/StringView.cpp:
(WTF::convertASCIILowercaseAtom):

5eec25d

WebKit should only reload WebViews automatically on crash if the view is visible
https://bugs.webkit.org/show_bug.cgi?id=240079
<rdar://92442052 >

Reviewed by NOBODY (OOPS!).

If the client app doesn't override WKNavigationDelegate.webViewWebContentProcessDidTerminate,
WebKit would previously reload the web view automatically. However, for some apps with a lot
of non-visible WebViews, this could cause a lot of churn when coming back to the foreground,
after many of these WebContent processes were jetsammed in the background.

To address this, WebKit now delays the automatic web view reload until the view becomes
visible (still reloads right away when the view is visible when the crash occurs).

* Tools/TestWebKitAPI/Tests/WebKitCocoa/WebContentProcessDidTerminate.mm:
(TEST):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::launchProcess):
(WebKit::WebPageProxy::activityStateDidChange):
(WebKit::WebPageProxy::viewIsBecomingVisible):
(WebKit::WebPageProxy::dispatchProcessDidTerminate):
* Source/WebKit/UIProcess/WebPageProxy.h:

cdumez added 2 commits May 4, 2022 15:06
… is visible

https://bugs.webkit.org/show_bug.cgi?id=240079
<rdar://92442052>

Reviewed by NOBODY (OOPS!).

If the client app doesn't override WKNavigationDelegate.webViewWebContentProcessDidTerminate,
WebKit would previously reload the web view automatically. However, for some apps with a lot
of non-visible WebViews, this could cause a lot of churn when coming back to the foreground,
after many of these WebContent processes were jetsammed in the background.

To address this, WebKit now delays the automatic web view reload until the view becomes
visible (still reloads right away when the view is visible when the crash occurs).

* Tools/TestWebKitAPI/Tests/WebKitCocoa/WebContentProcessDidTerminate.mm:
(TEST):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::launchProcess):
(WebKit::WebPageProxy::activityStateDidChange):
(WebKit::WebPageProxy::viewIsBecomingVisible):
(WebKit::WebPageProxy::dispatchProcessDidTerminate):
* Source/WebKit/UIProcess/WebPageProxy.h:
https://bugs.webkit.org/show_bug.cgi?id=240082

Reviewed by NOBODY (OOPS!).

Optimize / simplify slow case in StringView::convertASCIILowercaseAtom() where the input string
is not already lowercase. We now call `makeAtomString(lowercase(input))` which simplifies the
code a lot and is actually more efficient because makeAtomString() has an optimization that
avoids a StringImpl allocation when the string is relatively small (< 64 characters) and is
already part of the AtomStringTable already.

I validated the implementation by running it in a loop with the String "BODY" and got a
~35% speedup.

* Source/WTF/wtf/text/StringView.cpp:
(WTF::convertASCIILowercaseAtom):
@cdumez cdumez self-assigned this May 4, 2022
@cdumez cdumez closed this May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant