proposal: make a bunch of stuff inlinable
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- swift
- Domain
- performance
Research direction
Start by auditing the public APIs named in the proposal: FHIRPrimitive and its companion types, FHIRType-derived classes, conversion extensions, and operations such as ResourceProxy.get. Review which trivial operations can safely be marked @inlinable and which should remain excluded. Done means the appropriate public APIs are inlinable without exposing unsupported implementation details, with the proposal's performance goal addressed.
Written by the indexing model from the issue text.
Description
Current Situation
effectively none of the APIs in FHIRModels can be inlined by apps/packages using the FHIRModels package.
this is can become very painful, especially e.g. when creating a lot of FHIRPrimitives where the underlying value is just a copy of the input (eg: FHIRString, FHIRURI, FHIRDecimal, etc.)
context: our application's primary use case for FHIRModels is creating Observations (and via that a bunch of other FHIR types), which then get JSON-encoded and uploaded to a server. (we also sometimes use the package to decode and inspect data, but that's a tiny minority of our usage.)
it's not uncommon for our app to create millions of FHIR samples per day; as a result the lack of inlinability does actually have a significant and easily noticable impact on our app's performance.
Suggested Solution
i'd like to propose Apple consider marking as much of the FHIRModels package's public API as possible as @inlinable:
- all trivial operations on
FHIRPrimitiveand its companion types (FHIRString,FHIRURI,FHIRDecimal,FHIRInteger, etc)- initializers
- equatable implementations
- other operations (eg: stuff like
Base64Binary.data(using:),FHIRPrimitiveProtocol.extensions(for:),Instant.asNSDate(), etc) - all of the
asFHIR{Type}Primitive()extensions
- all initializers on
FHIRType-derived classes- including the convenience initializers; since they typically default all of their parameters to
nil, my understanding is that the compiler would end up emitting code only for setting those properties that actually are passed into the initializer, but i'll need to double-check that)
- including the convenience initializers; since they typically default all of their parameters to
- all trivial operations on
FHIRTypeand its derived classed (eg: theFHIRAbstractResourcehash and equality operations)
there are some things that probably don't make sense to inline (ResourceProxy.get comes to mind; i'm not sure how the compiler would handle that)
- Dominant language
- Swift
- Stars
- 209
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apple/FHIRModels
-
apple/FHIRModels#45 · 1 reaction · 1 assignee ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
apple/FHIRModels#44 · 1 comment · 1 reaction ·
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 52/100
apple/FHIRModels#42 ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
apple/FHIRModels#41 ·
-
enhancement question
apple/FHIRModels#34 · 1 comment · 1 assignee ·
All issues in apple/FHIRModels
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
type: docs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
googleapis/google-cloud-swift#971 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mozilla-mobile/firefox-ios#35743 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
manaflow-ai/cmux#13417 ·