Skip to content

Update handlecache.ts (#24233) #24256

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

Merged
merged 1 commit into from
Apr 4, 2025

Conversation

krauders
Copy link
Contributor

@krauders krauders commented Apr 4, 2025

Description

This is a cherry-pick of a performance improvement commit in order to patch the latest 2.31 client release.

While testing the performance of SharedMatrix when loading large CSV datasets of 100k-500k rows and 10-12 columns, it was identified that cacheMiss() contributes significantly to the overall performance. This change removes the spread operator and reduces the number of copies and edits made to the handles array. Performance testing shows a 3x improvement in time taken to load large dataset, and a 50-95% reduction in memory usage.

Original PR: #24233

## Description

While testing the performance of SharedMatrix when loading large CSV
datasets of 100k-500k rows and 10-12 columns, it was identified that
cacheMiss() contributes significantly to the overall performance. This
change removes the spread operator and reduces the number of copies and
edits made to the handles array. Performance testing shows a 3x
improvement in time taken to load large dataset, and a 50-95% reduction
in memory usage.
@github-actions github-actions bot added area: dds Issues related to distributed data structures base: release PRs targeted against a release branch labels Apr 4, 2025
Copy link
Contributor

github-actions bot commented Apr 4, 2025

Warning

WARNING: This PR is targeting a release branch!

All changes must first be merged into main and then backported to the target release branch.
Please include a link to the main PR in the description of this PR.

Changes to release branches require approval from the Patch Triage group before merging.
You should have already discussed this change with them so they know to expect it.

For more details, see our internal documentation for the patch policy and processes for
patch releases.

@krauders krauders marked this pull request as ready for review April 4, 2025 16:55
@Copilot Copilot AI review requested due to automatic review settings April 4, 2025 16:55
@krauders krauders requested a review from a team as a code owner April 4, 2025 16:55
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

packages/dds/matrix/src/handlecache.ts:75

  • [nitpick] The parameter name 'handles' might be confusing since this array is used to accumulate results. Consider renaming it to 'accumulatedHandles' or 'resultHandles' for clarity.
private getHandles(start: number, end: number, handles: Handle[]): Handle[] {

packages/dds/matrix/src/handlecache.ts:72

  • [nitpick] The doc comment for getHandles should be updated to clarify that the function appends results to a provided accumulator array instead of returning a new array, to avoid confusion for future maintainers.
/**

// TODO: This can be accelerated substantially using 'walkSegments()'. The only catch
// is that

const handles: Handle[] = [];
const { vector } = this;

for (let pos = start; pos < end; pos++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd think we want to remove return handles; statement at the bottom, as not used / useful?

@vladsud vladsud requested a review from anthony-murphy April 4, 2025 17:01
@krauders krauders enabled auto-merge (squash) April 4, 2025 17:06
@krauders krauders disabled auto-merge April 4, 2025 17:06
@borisf-msft borisf-msft self-requested a review April 4, 2025 17:22
@frankmueller-msft frankmueller-msft self-requested a review April 4, 2025 17:55
Copy link

@frankmueller-msft frankmueller-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@krauders krauders merged commit f9f6780 into release/client/2.31 Apr 4, 2025
50 checks passed
@krauders krauders deleted the krauders/release-patch-2.31 branch April 4, 2025 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds Issues related to distributed data structures base: release PRs targeted against a release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants