Skip to content

[Dequemodule, OrderedCollections] Avoid using floating point arithmetic#592

Merged
lorentey merged 1 commit intoapple:mainfrom
lorentey:floats-not-allowed-in-this-pool
Mar 7, 2026
Merged

[Dequemodule, OrderedCollections] Avoid using floating point arithmetic#592
lorentey merged 1 commit intoapple:mainfrom
lorentey:floats-not-allowed-in-this-pool

Conversation

@lorentey
Copy link
Copy Markdown
Member

@lorentey lorentey commented Mar 7, 2026

Deque and the OrderedSet/OrderedDictionary types are using floating-point arithmetic to resize themselves, for no particularly good reason. Rewrite them to use integer arithmetic instead.

This is a record-breakingly slow reaction to @rauhul's 2024 observation that FPUs aren't necessarily available in all environments that may want to use these types.

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.

@lorentey lorentey added this to the 1.4.1 milestone Mar 7, 2026
@lorentey lorentey merged commit 7ad524e into apple:main Mar 7, 2026
150 of 156 checks passed
@lorentey lorentey deleted the floats-not-allowed-in-this-pool branch March 7, 2026 04:30
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