firely-cql-sdk icon indicating copy to clipboard operation
firely-cql-sdk copied to clipboard

Extension access is translated rather wastefully

Open ewoutkramer opened this issue 5 months ago • 0 comments

When we write CQL to check for an extension, this is what gets generated:

E.g. from DementiaCognitiveAssessmentFHIR-0.1.000.g.cs

string ac_ = @this?.Url;
FhirString ad_ = context.Operators.Convert<FhirString>(ac_);
string ae_ = FHIRHelpers_4_3_000.ToString(ad_);
bool? af_ = context.Operators.Equal(ae_, "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-notDoneReason");

It's correct: an Extension.Url is a FhirString, and so we translate the FhirString to a string to be able to compare it to the fixed extension url. furthermore, because the underlying Firely model returns a string, we'll first have to actually make it a FhirString. But the net effect are useless conversions. Since this is a very common pattern, it will hurt performance. Is there something we can do about it?

ewoutkramer avatar Aug 28 '24 16:08 ewoutkramer