Skip to content

A new way to bridge constant NSStrings #74881

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

Merged
merged 11 commits into from
Jul 4, 2024
Merged

Conversation

Catfish-Man
Copy link
Contributor

@Catfish-Man Catfish-Man commented Jul 2, 2024

rdar://130992941

This introduces a new SPI for Foundation to call that allows access to ASCII constant NSString's contents without having to indirect through ObjC messaging

@Catfish-Man Catfish-Man self-assigned this Jul 2, 2024
@Catfish-Man
Copy link
Contributor Author

@swift-ci please test

@Catfish-Man
Copy link
Contributor Author

@swift-ci please Apple Silicon benchmark

@Catfish-Man
Copy link
Contributor Author

note: we are not expecting any wins because this functionality hasn't been adopted yet, we're just hoping for no notable losses

@Catfish-Man
Copy link
Contributor Author

@swift-ci please Apple Silicon benchmark

@Catfish-Man
Copy link
Contributor Author

@swift-ci please test

@Catfish-Man
Copy link
Contributor Author

@swift-ci please Apple Silicon benchmark

@Catfish-Man
Copy link
Contributor Author

@swift-ci please test

@Catfish-Man Catfish-Man changed the title Untested draft implementation of yet another new way to bridge constant NSStrings Draft implementation of yet another new way to bridge constant NSStrings Jul 2, 2024
@Catfish-Man
Copy link
Contributor Author

Only remaining failed tests are due to the new ABI, so I'll just need to add availability

Failed Tests (2):
Swift(macosx-x86_64) :: abi/macOS/x86_64/stdlib-asserts.swift
Swift(macosx-x86_64) :: api-digester/stability-stdlib-abi-with-asserts.test

@Catfish-Man
Copy link
Contributor Author

@swift-ci please test

@Catfish-Man Catfish-Man marked this pull request as ready for review July 2, 2024 19:08
@Catfish-Man Catfish-Man requested a review from a team as a code owner July 2, 2024 19:08
@Catfish-Man Catfish-Man requested a review from milseman July 2, 2024 19:08
@Catfish-Man
Copy link
Contributor Author

@swift-ci please test

@Catfish-Man
Copy link
Contributor Author

@swift-ci please Apple Silicon benchmark

@Catfish-Man
Copy link
Contributor Author

@swift-ci please benchmark

@Catfish-Man
Copy link
Contributor Author

@swift-ci please test

@Catfish-Man
Copy link
Contributor Author

Benchmarking is waiting on #74911

@Catfish-Man
Copy link
Contributor Author

@swift-ci please Apple Silicon benchmark

@Catfish-Man
Copy link
Contributor Author

@swift-ci please benchmark

@Catfish-Man
Copy link
Contributor Author

Somehow performance improved??

------- Performance (arm64): -Osize -------

REGRESSION                                            OLD        NEW        DELTA     RATIO    
StringWithCString2                                    0.0        0.001      +100.0%   **0.50x (?)**
BufferFillFromSlice                                   10.547     12.255     +16.2%    **0.86x (?)**

IMPROVEMENT                                           OLD        NEW        DELTA     RATIO    
CxxStringConversion.cxx.to.swift                      75.0       55.417     -26.1%    **1.35x (?)**
UTF8Decode_InitFromData_ascii                         109.722    89.889     -18.1%    **1.22x**
StringWalk                                            1196.923   1013.846   -15.3%    **1.18x**
UTF8Decode_InitFromCustom_contiguous_ascii            101.955    87.56      -14.1%    **1.16x**
EqualSubstringSubstringGenericEquatable               20.427     17.556     -14.1%    **1.16x**
EqualSubstringString                                  20.24      17.425     -13.9%    **1.16x**
LessSubstringSubstringGenericComparable               20.365     17.566     -13.7%    **1.16x**
EqualStringSubstring                                  20.151     17.419     -13.6%    **1.16x**
EqualSubstringSubstring                               20.302     17.583     -13.4%    **1.15x**
LessSubstringSubstring                                20.292     17.611     -13.2%    **1.15x**
UTF8Decode_InitFromBytes_ascii_as_ascii               131.294    114.895    -12.5%    **1.14x (?)**
UTF8Decode_InitDecoding_ascii                         96.955     85.478     -11.8%    **1.13x**
UTF8Decode_InitFromBytes_ascii                        128.722    114.444    -11.1%    **1.12x**
UTF8Decode_InitDecoding_ascii_as_ascii                104.238    92.696     -11.1%    **1.12x (?)**
UTF8Decode_InitFromData_ascii_as_ascii                104.81     93.417     -10.9%    **1.12x (?)**
CharIteration_punctuated_unicodeScalars               702.0      633.478    -9.8%     **1.11x**
UTF8Decode_InitFromCustom_contiguous_ascii_as_ascii   144.154    130.846    -9.2%     **1.10x (?)**
CStringLongAscii                                      90.042     82.923     -7.9%     **1.09x (?)**
CharIteration_tweet_unicodeScalars                    5277.647   4913.333   -6.9%     **1.07x**
CharIteration_ascii_unicodeScalars                    2705.806   2520.0     -6.9%     **1.07x**

------- Code size: -Osize -------

@Catfish-Man
Copy link
Contributor Author

@swift-ci please test

Copy link
Member

@milseman milseman left a comment

Choose a reason for hiding this comment

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

Approved after resolving the object identifier bug in test case.

@Catfish-Man Catfish-Man changed the title Draft implementation of yet another new way to bridge constant NSStrings A new way to bridge constant NSStrings Jul 3, 2024
@Catfish-Man Catfish-Man enabled auto-merge (squash) July 3, 2024 20:17
@Catfish-Man
Copy link
Contributor Author

@swift-ci please test

@Catfish-Man Catfish-Man merged commit 3589044 into main Jul 4, 2024
4 of 5 checks passed
@Catfish-Man Catfish-Man deleted the there-and-back-again-again branch July 4, 2024 03:38
kastiglione added a commit to swiftlang/llvm-project that referenced this pull request Dec 11, 2024
Supports a new discriminator case: immortal, bridged. Added in swiftlang/swift#74881.
kastiglione added a commit to swiftlang/llvm-project that referenced this pull request Dec 13, 2024
Supports a new discriminator case: immortal, bridged. Added in swiftlang/swift#74881.

(cherry-picked from commit 3b70fcc)
kastiglione added a commit to swiftlang/llvm-project that referenced this pull request Dec 13, 2024
Supports a new discriminator case: immortal, bridged. Added in swiftlang/swift#74881.

(cherry-picked from commit 3b70fcc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants