-
Notifications
You must be signed in to change notification settings - Fork 419
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
Gather and validate all resource references at one time #5496
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Hoping to see some wins from this. Let's put this on staging first just for sanity check?
} catch (err) { | ||
issues.push(createStructureIssue(path, `Invalid reference (${normalizeErrorString(err)})`)); | ||
const validated = await repo.readReferences(toValidate); | ||
for (let i = 0; i < validated.length; i ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love numeric for loops 👍
const validated = await repo.readReferences(toValidate); | ||
for (let i = 0; i < validated.length; i ) { | ||
const reference = validated[i]; | ||
if (reference instanceof Error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instanceof
in a hot loop is not great, I wish we had a tagged union or something (eg. Option type), but alas.
It's obviously the right choice here just making a note
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ThatOneBro Is there anything else we should consider here? Would inverting the condition by calling e.g. isResource()
instead be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it could improve things slightly, worth a try
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We ran a microbenchmark on both approaches, and discovered that for this use case instanceof Error
is about 10x faster than isResource()
Quality Gate passedIssues Measures |
This reverts commit bc98343.
## What's Changed * Update deb-s3 upload command (#5494) * More build-deb action fixes (#5497) * Added GCP Secret Manager support and configType: gcp (#5462) * Case-insensitive search on ContactPoint (#5455) * Centralize token index type determination logic (#5500) * Gather and validate all resource references at one time (#5496) * Revert "Gather and validate all resource references at one time (#5496)" (#5504) * Improve FHIR Datastore docs (#5484) * Check all references at once (#5508) * Fix QuestionnaireForm dependency on requestSchema (#5509) * fix(agent): harden reconnect logic (#5476) * Tighten up JSON vs FHIR JSON response formatting (#5506) **Full Changelog**: v3.2.19...v3.2.20
## What's Changed * Update deb-s3 upload command (#5494) * More build-deb action fixes (#5497) * Added GCP Secret Manager support and configType: gcp (#5462) * Case-insensitive search on ContactPoint (#5455) * Centralize token index type determination logic (#5500) * Gather and validate all resource references at one time (#5496) * Revert "Gather and validate all resource references at one time (#5496)" (#5504) * Improve FHIR Datastore docs (#5484) * Check all references at once (#5508) * Fix QuestionnaireForm dependency on requestSchema (#5509) * fix(agent): harden reconnect logic (#5476) * Tighten up JSON vs FHIR JSON response formatting (#5506) **Full Changelog**: v3.2.19...v3.2.20
No description provided.