Skip to content

NFC: better CanType perf #16553

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 2 commits into from
May 11, 2018

Conversation

davezarzycki
Copy link
Contributor

These two commits improve the Release+Assert build performance of Swift.o by about 5.4% on my machine. This matters less without asserts enabled.

This is on the very hot path for Release+Assert builds.
Fetching the canonical type is on the hot path.
@davezarzycki davezarzycki requested a review from CodaFi May 11, 2018 19:04
@davezarzycki
Copy link
Contributor Author

@swift-ci please smoke test

@CodaFi
Copy link
Contributor

CodaFi commented May 11, 2018

How much of the perf improvement is from dropping llvm::PointerUnion?

@jrose-apple
Copy link
Contributor

I imagine the win is that you no longer have to mask off the low bit to dereference the pointer, not anything else in PointerUnion.

@jrose-apple
Copy link
Contributor

…oh, right, assertions. Never mind, question still valid.

@davezarzycki
Copy link
Contributor Author

davezarzycki commented May 11, 2018

Dropping this specific llvm::PointerUnion yields:

  • 0.83% faster on average (wall clock).
  • 2.36% fewer branches

Please also note that PointerUnion isn't bad per se, we just have spare bits elsewhere and this is a critical path.

Copy link
Contributor

@CodaFi CodaFi left a comment

Choose a reason for hiding this comment

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

Excellent work. Gonna run full tests first because this is a core abstraction.

@CodaFi
Copy link
Contributor

CodaFi commented May 11, 2018

@swift-ci please test

@davezarzycki
Copy link
Contributor Author

I always run ninja check-swift-validation on my Linux box before pushing. I'd be surprised if anything breaks.

@davezarzycki davezarzycki merged commit a95a4b9 into swiftlang:master May 11, 2018
@davezarzycki davezarzycki deleted the nfc_better_cantype_perf branch May 11, 2018 23:06
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.

3 participants