Skip to content

Conversation

bendikberg
Copy link
Contributor

@bendikberg bendikberg commented Feb 18, 2025

Purpose

This function is in the hot path when loading a workspace, and takes a disproportionate amount of time given its complexity.

This PR reduces the time spent by this function by reducing time spent splitting and allocating new strings and string arrays and inside linq iterators. Instead this function now just compares the backing char spans of the two strings for end equality.

(Maybe this whole thing could be replaced with fullName.EndsWith(qualifiedName)?)

Performance

This reduces the time taken by this function by a substantial amount, but the function itself has low impact.

Old
openjson_funcgroup

New
openjson_funcgroup_nonallocating

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB

Release Notes

N/A

Reviewers

@mjkkirschner

FYIs

@dimven

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants