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

can we get @inlinable on properties when generating code into SPM package? #3431

Closed
ZeeWanderer opened this issue Aug 28, 2024 · 3 comments
Closed
Labels
codegen Issues related to or arising from code generation feature New addition or enhancement to existing solutions

Comments

@ZeeWanderer
Copy link

ZeeWanderer commented Aug 28, 2024

Question

Is there an option to add inlining to spm package?

When generating files into an SPM package its a separate compile module so unless properties/functions are marked with @inlinable to my understanding no inlining will occur.
In particular wrapper properties like

public var results: [Result] { __data["results"] }

Will benefit from it.

@ZeeWanderer ZeeWanderer added the question Issues that have a question which should be addressed label Aug 28, 2024
@ZeeWanderer ZeeWanderer changed the title can we get @inlineable on properties when generation code into SPM package? can we get @inlinable on properties when generation code into SPM package? Aug 28, 2024
@ZeeWanderer ZeeWanderer changed the title can we get @inlinable on properties when generation code into SPM package? can we get @inlinable on properties when generating code into SPM package? Aug 28, 2024
@calvincestari calvincestari added feature New addition or enhancement to existing solutions codegen Issues related to or arising from code generation and removed question Issues that have a question which should be addressed labels Aug 28, 2024
@calvincestari
Copy link
Member

Hi @ZeeWanderer 👋🏻 - no, there is not any configuration option at the moment to generate @inlinable property accessors.

I'll take this feature request to our next team planning meeting and gather opinion from the rest of the team; could be a week or so before I get back to you though.

@calvincestari
Copy link
Member

Apologies for taking so long to get back to you on this issue - we finally got together to discuss this a bit more.

When generating files into an SPM package its a separate compile module so unless properties/functions are marked with @inlinable to my understanding no inlining will occur.

I believe this used to be the case before Swift 5.8 where a conservative implementation of Cross Module Optimization was introduced as a default compiler optimization. The impact of this should be that if you are compiling the source for all modules at build time then @inlinable has no effect because everything is by default inlinable.

I'm going to close this issue as there does not seem to be any benefit to a adding @inlinable to generated packages. If you were distributing a package containing your generated models as a prebuilt binary then I could see where @inlinable becomes useful. Are there other use cases where you think this is still beneficial?

@calvincestari calvincestari closed this as not planned Won't fix, can't repro, duplicate, stale Sep 24, 2024
Copy link
Contributor

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codegen Issues related to or arising from code generation feature New addition or enhancement to existing solutions
Projects
None yet
Development

No branches or pull requests

2 participants