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

fix: Sort private attributes for improved stable encoding #401

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

keelerm84
Copy link
Member

To help increase cache hits, we want to always use a stable encoding for the context. This was done in a previous commit when we added the encoder.outputFormatting = [.sortedKeys] modification.

A context's private attributes are sorted as a set, which makes no guarantee about encoding order. To address this, we are sorting the private attributes prior to the JSON encoding phase. As a result, we would expect to see an increase in cache hits for customers.

To help increase cache hits, we want to always use a stable encoding for
the context. This was done in a previous commit when we added the
`encoder.outputFormatting = [.sortedKeys]` modification.

A context's private attributes are sorted as a set, which makes no
guarantee about encoding order. To address this, we are sorting the
private attributes prior to the JSON encoding phase. As a result, we
would expect to see an increase in cache hits for customers.
@keelerm84 keelerm84 requested a review from a team as a code owner August 5, 2024 15:22
@keelerm84 keelerm84 merged commit 90bf896 into v9 Aug 5, 2024
4 checks passed
@keelerm84 keelerm84 deleted the mk/sc-252268/sort-private branch August 5, 2024 16:20
keelerm84 pushed a commit that referenced this pull request Aug 7, 2024
🤖 I have created a release *beep* *boop*
---


##
[9.10.0](9.9.0...9.10.0)
(2024-08-07)


### Features

* Update caching strategy to allow for greater cache use
([#404](#404))
([62587ad](62587ad))


### Bug Fixes

* Sort private attributes for improved stable encoding
([#401](#401))
([90bf896](90bf896))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: LaunchDarklyReleaseBot <LaunchDarklyReleaseBot@launchdarkly.com>
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.

2 participants