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

Make OrderedSet.firstIndex ~4% faster by reducing ARC traffic #451

Open
wants to merge 1 commit into
base: release/1.2
Choose a base branch
from

Conversation

dnadoba
Copy link
Member

@dnadoba dnadoba commented Feb 9, 2025

OrderedSet.firstIndex(of:) runs into some retain/release overhead that make up ~4% of its runtime.
Adding @_effects(releasenone) get's rid of this.

I have personally never used @_effects(releasenone) before but I have seen it used throughout this project. If I understand its behavior correctly it should be safe to use it here but I'm not certain.

Tested with

  • Apple Swift version 6.1 (swiftlang-6.1.0.1.51 clang-1600.3.2.3)
  • DEVELOPMENT-SNAPSHOT-2025-02-06-a (6.2.20250206101)

Checklist

  • I've read the Contribution Guidelines
  • My contributions are licensed under the Swift license.
  • I've followed the coding style of the rest of the project.
  • I've added tests covering all new code paths my change adds to the project (if appropriate).
  • I've added benchmarks covering new functionality (if appropriate).
  • I've verified that my change does not break any existing tests or introduce unexplained benchmark regressions.
  • I've updated the documentation if necessary.

@dnadoba dnadoba requested a review from lorentey as a code owner February 9, 2025 21:03
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