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

[JSC] Micro-optimize String equal operation with UChar / LChar #23804

Conversation

Constellation
Copy link
Member

@Constellation Constellation commented Feb 3, 2024

@Constellation Constellation self-assigned this Feb 3, 2024
@@ -344,13 +344,36 @@ ALWAYS_INLINE bool equal(const LChar* a, const UChar* b, unsigned length)
}
return true;
}
// Otherwise, we just do a naive loop.
#endif
if (length >= 4) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the cases < 8 don't use SIMD intrinsics, couldn't these also be enabled for x64 without further changes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is relying on that we have length >= 8 loop, which x64 does not have.

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Feb 3, 2024
@Constellation Constellation removed the merging-blocked Applied to prevent a change from being merged label Feb 3, 2024
@Constellation Constellation force-pushed the eng/JSC-Micro-optimize-String-equal-operation-with-UChar--LChar branch from 388bff0 to 1a508d6 Compare February 3, 2024 17:36
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Feb 3, 2024
@Constellation Constellation added unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing and removed merging-blocked Applied to prevent a change from being merged labels Feb 4, 2024
https://bugs.webkit.org/show_bug.cgi?id=268684
rdar://122224476

Reviewed by Ryosuke Niwa.

This patch micro-optimizes String equal operation with different characters (UChar* and LChar*).

                                                         ToT                     Patched

    todomvc-javascript-es5-json-parse              37.6466+-0.1862     ^     37.1991+-0.1560        ^ definitely 1.0120x faster
    todomvc-javascript-es6-webpack-json-parse
                                                   58.9239+-0.3310     ^     58.2251+-0.1931        ^ definitely 1.0120x faster

* Source/WTF/wtf/text/StringCommon.h:

Canonical link: https://commits.webkit.org/274064@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/JSC-Micro-optimize-String-equal-operation-with-UChar--LChar branch from 1a508d6 to bacdbda Compare February 4, 2024 07:32
@webkit-commit-queue
Copy link
Collaborator

Committed 274064@main (bacdbda): https://commits.webkit.org/274064@main

Reviewed commits have been landed. Closing PR #23804 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit bacdbda into WebKit:main Feb 4, 2024
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants