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

For performance, compactOrdered decodePassable should minimize reparsing #1747

Open
gibson042 opened this issue Aug 28, 2023 · 1 comment
Open
Assignees
Labels
enhancement New feature or request performance

Comments

@gibson042
Copy link
Contributor

Extracted from #1594 (comment)

What is the Problem Being Solved?

The depth-aware array-decoding function introduced in #1594 is aware of each leaf node in a deep structure, but decoding is a recursive operation with string input. This means that nested arrays are fully traversed and comprehended, but that information is discarded in the calls that ultimately deserialize their constituent elements.

Description of the Design

The function should instead be provided with an ephemeral cache shared across the call stack of an outermost call to decodePassable, such that the outermost decodeArray function can populate it and reentrant calls can return from it rather than iterating over an already-visited slice of the input string.

Security Considerations

None in particular.

Scaling Considerations

This is only worth pursuing if it actually improves performance, specifically time complexity without an undue degradation of space complexity.

Test Plan

Per the above, we should perform some kind of benchmarking.

Upgrade Considerations

None; this will be a functionality-preserving optimization.

@gibson042 gibson042 added the enhancement New feature or request label Aug 28, 2023
@gibson042 gibson042 self-assigned this Oct 5, 2023
@kriskowal kriskowal added the kriskowal-review-2024-01 Issues that kriskowal wants to bring to the attention of the team for review as of January, 2024 label Jan 8, 2024
@aj-agoric aj-agoric added performance and removed kriskowal-review-2024-01 Issues that kriskowal wants to bring to the attention of the team for review as of January, 2024 labels Jan 31, 2024
@erights
Copy link
Contributor

erights commented Mar 4, 2024

@gibson042 , does this also apply to compactOrdered? If not, I suggest closing as won't fix. If so, I suggest renaming.

@gibson042 gibson042 changed the title For performance, decodePassable should minimize reparsing For performance, compactOrdered decodePassable should minimize reparsing Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance
Projects
None yet
Development

No branches or pull requests

4 participants