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

Add :immutable parameter to from-json #78

Merged
merged 8 commits into from Feb 10, 2022
Merged

Conversation

lizmat
Copy link
Contributor

@lizmat lizmat commented Nov 3, 2021

Add :immutable parameter to from-json and some other optimizations

  • abstract die-ing logic into separate subs to reduce the binary size of the processing units, making it likelier they would be inlined if no errors are encountered
  • abstracted parsing "true", "false", "null" into subs so that they can be used in ternaries, they should easily be inlined if so needed.
  • converted parse-thing to just ternaries for better readability
  • created "immutable" versions of parse-thing, parse-obj and parse-array to contain optimized versions of parsing logic for immutable results.
  • makes "normal" parsing about 1% faster (on a 6MB JSON file with all of the Raku ecosystem's current and past JSON files)
  • "immutable" parsing is about 5% faster, and creates about 9% smaller memory footprint (for that 6MB JSON file).
  • in the case of immutable parsing, empty arrays and hashes are actually bound to a singleton empty List and Map
  • added documentation for the from-json :immutable feature
  • Upped the version for convenience and to more easily allow comparisons to be made locally

- abstract die-ing logic into separate subs to reduce the binary
  size of the processing units, making it likelier they would be
  inlined if no errors are encountered
- abstracted parsing "true", "false", "null" into subs so that
  they can be used in ternaries, they should easily be inlined
  if so needed.
- converted parse-thing to just ternaries for better readability
- created "immutable" versions of parse-thing, parse-obj and
  parse-array to contain optimized versions of parsing logic
  for immutable results.
- makes "normal" parsing about 1% faster (on a 6MB JSON file
  with all of the Raku ecosystem's current and past JSON files)
- "immutable" parsing is about 5% faster, and creates about
  9% smaller memory footprint (for that 6MB JSON file).
- in the case of immutable parsing, empty arrays and hashes
  are actually bound to a singleton empty List and Map
- added documentation for the from-json :immutable feature
- Upped the version for convenience and to more easily allow
  comparisons to be made locally
@lizmat lizmat changed the title From json immutable Add :immutable parameter to from-json Nov 3, 2021
@lizmat
Copy link
Contributor Author

lizmat commented Dec 21, 2021

Any progress? Anything wrong? The suspense is killing me! :-)

@lizmat
Copy link
Contributor Author

lizmat commented Jan 27, 2022

@timo Hope you're holding up on your $work.

If it is becoming too much for you to maintain this module, please let me know. I could well take over maintenance of this module, as am pretty aware of its inner workings :-)

@lizmat
Copy link
Contributor Author

lizmat commented Jan 28, 2022

Or we could move it to community-modules?

@lizmat
Copy link
Contributor Author

lizmat commented Feb 9, 2022

It's been over 3 months now, and I'm getting tired of waiting. And seriously considering forking this module in raku-community-modules and releasing it with a higher version number.

Please let me know if there is anything that needs to be done to this PR to make it acceptable.

@timo timo merged commit efb781d into timo:master Feb 10, 2022
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.

None yet

2 participants