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

Add inlinable notations to public API #26

Conversation

roanutil
Copy link
Owner

Something I've been aware of but not considered much is that Swift offers notations that control public module interface and may allow better optimizations when used from outside the module.

At a minimum, it seems to be good to mark public methods and computed properties as @inlinable. A declaration that is marked as @inlinable requires that internal declarations called within it be marked as @usableFromInline.

I haven't exhaustively covered each possible declaration but the primary public API should all be covered now.

https://github.com/apple/swift-evolution/blob/b8731d0d086c5cc0a08457a917c1d88ba3d202d2/proposals/0193-cross-module-inlining-and-specialization.md
https://forums.swift.org/t/when-should-both-inlinable-and-inline-always-be-used/37375

…c specializations by the compiler

feature/add-inlinable-notations-to-encourage-generic-specialization
…other compiler optimizations

feature/add-inlinable-notations-to-encourage-generic-specialization
@codecov-commenter
Copy link

codecov-commenter commented Mar 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.78%. Comparing base (8b3f49e) to head (467294e).
Report is 11 commits behind head on 3.0-preview.

Additional details and impacted files
@@               Coverage Diff               @@
##           3.0-preview      #26      +/-   ##
===============================================
- Coverage        83.87%   83.78%   -0.09%     
===============================================
  Files               34       35       +1     
  Lines             2822     2819       -3     
===============================================
- Hits              2367     2362       -5     
- Misses             455      457       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@roanutil roanutil changed the base branch from main to 3.0-preview March 28, 2024 01:03
…courage-generic-specialization

# Conflicts:
#	Sources/CoreDataRepository/CoreDataRepository+CRUD.swift
#	Sources/CoreDataRepository/NSManagedObject+Helpers.swift
#	Sources/CoreDataRepository/NSManagedObjectContext+Helpers.swift
feature/add-inlinable-notations-to-encourage-generic-specialization
@roanutil roanutil merged commit 305ea11 into 3.0-preview Apr 10, 2024
3 checks passed
@roanutil roanutil deleted the feature/add-inlinable-notations-to-encourage-generic-specialization branch April 10, 2024 21:00
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