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

Avoid n^2 complexity during decoding #12

Merged
merged 1 commit into from
Feb 24, 2023
Merged

Conversation

nsavoire
Copy link
Contributor

push using Array.concat creates a new copy of the array for each inserted element and leads to n^2 complexity when decoding arrays. For pprof with large numbers of samples, this quickly leads to very long decoding (>1 min) compared to ~1s with this change.

@nsavoire nsavoire added the semver-patch Bug and security fixes label Feb 22, 2023
@github-actions
Copy link

github-actions bot commented Feb 22, 2023

Overall package size

Self size: 165.24 kB
Deduped: 165.24 kB
No deduping: 165.24 kB

Dependency sizes

name version self size total size

🤖 This report was automatically generated by heaviest-objects-in-the-universe

`push` using `Array.concat` creates a new copy of the array for each
inserted element and leads to n^2 complexity when decoding arrays.
For pprof with large numbers of samples, this quickly leads to very long
decoding (>1 min) compared to ~1s with this change.
@nsavoire nsavoire merged commit 0a75894 into main Feb 24, 2023
@nsavoire nsavoire deleted the nsavoire/improve_decode branch February 24, 2023 09:38
nsavoire added a commit that referenced this pull request Feb 24, 2023
`push` using `Array.concat` creates a new copy of the array for each
inserted element and leads to n^2 complexity when decoding arrays.
For pprof with large numbers of samples, this quickly leads to very long
decoding (>1 min) compared to ~1s with this change.
nsavoire added a commit that referenced this pull request Feb 27, 2023
* Avoid n^2 complexity during decoding (#12)

`push` using `Array.concat` creates a new copy of the array for each
inserted element and leads to n^2 complexity when decoding arrays.
For pprof with large numbers of samples, this quickly leads to very long
decoding (>1 min) compared to ~1s with this change.

* Add some interoperability tests with protobufjs (#13)

Check that profiles encoded with pprof-format can be decoded by
protobufjs and that pprof-format can decode profiles encoded with
protobufjs.

* v2.0.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-patch Bug and security fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants