FirelyTeam / firely-cql-sdk

BSD 3-Clause "New" or "Revised" License
31 stars 17 forks source link

Extension access is translated rather wastefully #494

Open ewoutkramer opened 3 months ago

ewoutkramer commented 3 months ago

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?