Skip to content
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

Implement more performant partial IO #808

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Conversation

reczkok
Copy link
Collaborator

@reczkok reczkok commented Jan 28, 2025

Performance vs #803:

#803 this
old new

@reczkok reczkok mentioned this pull request Jan 28, 2025
3 tasks
Copy link

codesandbox-ci bot commented Jan 28, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Comment on lines +47 to +49
const sortedProps = Object.entries(propOffsets).sort(
(a, b) => a[1].offset - b[1].offset, // Sort by offset
);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The propOffsets should always be in the correct order already. But I don't think it's guaranteed. It doesn't cost much to sort it here.

throw new Error('Partial value for array must be an array');
}

partialValue.sort((a, b) => a.idx - b.idx);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is necessary since we don't want to sort all the write instructions later. If we don't sort here the instructions will still be valid but will not get properly merged. Sorting here is way less of an overhead than sorting all the instructions.

@reczkok reczkok marked this pull request as ready for review January 29, 2025 11:00
@reczkok reczkok requested review from iwoplaza and mhawryluk and removed request for iwoplaza January 29, 2025 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant