-
-
Notifications
You must be signed in to change notification settings - Fork 746
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
Update JSON serialization and deserialization code to use orjson
library
#5153
Merged
Merged
Changes from 31 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
19d27cd
Add WIP code changes to utilize orjson instead of json library.
Kami 4ce29a7
Add WIP micro-benchmarks for fast_deepcopy() implementations.
Kami a05cbc2
Update more code.
Kami 6db1daf
Add another micro benchmarks for fast_deepcopy which utilizes actual
Kami 4970944
Add new system.json_library config option which specifies which json
Kami e10295e
Also include json and simplejson in the benchmark.
Kami f910be1
More tests and changes for cross compatibility.
Kami 19357c4
More compatibility fixes.
Kami 2d38d2c
Update more code to use json_encode / json_decode wrapper functions.
Kami f6aa540
Fix lint.
Kami 205beb3
Use better module name.
Kami d1b370d
Hook it up to CI.
Kami 7a2a1fb
Fix lint.
Kami 6847fb9
Update more affected code, transparently handle ObjectIds.
Kami cf319d2
Also handle ObjectId instances transparently.
Kami 0277f9b
Update affected code.
Kami f3daf73
Generate requirements files.
Kami aa937a1
Update comment.
Kami dd26179
Fix lint.
Kami b68ae13
Update affected tests.
Kami 69fa45f
Fix lint.
Kami 6c2756f
Add changelog entry.
Kami 90c088a
Also add micro benchmarks for json serialization an deserialization.
Kami a3581c0
Merge branch 'master' of github.com:StackStorm/st2 into orjson_prototype
Kami 9bb9739
Update more code to use more efficient json encode / decode library.
Kami 3282d0a
Merge branch 'master' into orjson_prototype
Kami b6a965f
Use latest version of orjson.
Kami 5f75210
Update help string.
Kami 8a6d8ae
Don't publicly document the config option which is really just used as a
Kami 55b92b4
Merge branch 'master' into orjson_prototype
Kami d0b9952
Add back file which was accidentaly removed.
Kami 59f2c49
Add a workaround for tests.
Kami 1062426
Merge branch 'master' of github.com:StackStorm/st2 into orjson_prototype
Kami bd202f4
Remove config option we don't want to expose to the end users anyway and
Kami ee0bd1f
Make sure we clear up after each test to avoid cross test pollution.
Kami e918d23
Update st2common/benchmarks/micro/test_fast_deepcopy.py
Kami a2ef1e6
Use sys.stdout.buffer instead of sys.stdout.
Kami f2bd250
Update service setup code so also print used locale and fs encoding.
Kami 8208625
Merge branch 'orjson_prototype' of github.com:StackStorm/st2 into orj…
Kami 5e08942
Update affected tests, add test for verifying service startup messages.
Kami af9228c
Default SKIP_OPTIONS to an empty list.
Kami dfd533c
Merge branch 'master' of github.com:StackStorm/st2 into orjson_prototype
Kami bd4eb01
Update function docstring / comment.
Kami c80d07a
Add additional tests for it.
Kami 9ba8d45
Rename function to fast_deepcopy_dict() since it's primarily used on
Kami File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we call this module json util or something so to be clear this is json specific operation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I intentionally renamed it to
deep_copy
since I think previous name was a bad one (I know, I picked it originally :D) - previous name was leaking implementation details which should not matter to the end user.I think
deep_copy
is a better name since it conveys what the module is used for - deep copying dictionaries.And the module is not JSON specific either, it's can deep copy arbitrary dictionaries with simple types.
orjson
is just an implementation detail of that function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want this to be confused with copy.deepcopy which is not json or dict specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I can rename it to
fast_deepcopy_dict
then? (the function name that is)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I guess I need to be more explicitly - it doesn't just support dicts either (that's just how we use it).
It supports any kind of value as long as it only contains simple types (so no class instances, etc.).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per discussion on Slack, I pushed a couple of changes - add some more tests, update function docstring comment, rename it to
fast_deepcopy_dict
(bd4eb01, c80d07a, 9ba8d45).As discussed, it can also be used on other simple values (think lists) and not just dictionaries, but using it on dictionaries with simple value types is our primary use case for it so I think that name is an OK compromise for now.