Skip to content

Add a cross-encoding version of strcmp, use it in bridged String equality, and expose it for Foundation's use#87271

Draft
Catfish-Man wants to merge 7 commits intomainfrom
david/equal_in_the_eyes_of_strcmp
Draft

Add a cross-encoding version of strcmp, use it in bridged String equality, and expose it for Foundation's use#87271
Catfish-Man wants to merge 7 commits intomainfrom
david/equal_in_the_eyes_of_strcmp

Conversation

@Catfish-Man
Copy link
Contributor

No description provided.

@Catfish-Man Catfish-Man self-assigned this Feb 17, 2026
@Catfish-Man
Copy link
Contributor Author

@swift-ci please test

@@ -702,6 +702,41 @@ internal func _SwiftCreateBridgedString_DoNotCall(
}
}

@c public func _unicodeBuffersEqual(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this need to be @_spi too? I should verify that those interact in the way I hope

return true
}

internal func isEqual<LHSEncoding: _UnicodeEncoding, RHSEncoding: _UnicodeEncoding>(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should probably name this something less intrusive if I'm going to leave it as a free function

@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
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
Copy link
Contributor Author

Benchmark results looked decent. 17% or so win for bridged string equality, which tests a bunch of other cases, and with this only partly adopted :)

@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
Copy link
Contributor Author

@swift-ci please Apple Silicon benchmark

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.

1 participant