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

Using alternates besides JSONDecoder for deserialization #81

Open
michaeleisel opened this issue Sep 16, 2019 · 6 comments
Open

Using alternates besides JSONDecoder for deserialization #81

michaeleisel opened this issue Sep 16, 2019 · 6 comments

Comments

@michaeleisel
Copy link

michaeleisel commented Sep 16, 2019

ZippyJSON (a framework that I created), is a 3-4x faster version of JSONDecoder. Using it could be a big speed boost for consumers. However, the customization provided by #28 doesn't allow for anything besides JSONDecoder (or a subclass of it). This makes it difficult to use ZippyJSON because alternate implementations are best not to subclass it to ensure good performance. Here are some possibilities:

  • Allow users to pass in anything that implements TopLevelDecoder, and not just JSONDecoder
  • Mention performance wins from using a custom implementation like ZippyJSON
  • Simply use ZippyJSON behind the scenes by default
@michaeleisel michaeleisel changed the title Use ZippyJSON instead of JSONDecoder as the default Using alternates besides JSONDecoder for deserialization Sep 16, 2019
@michaeleisel
Copy link
Author

To be clear, a well-written binary decoder/encoder would be faster, but I don't know if one exists right now (e.g. a fast MessagePack encoder/decoder)

@RamblinWreck77
Copy link

This would be cool! I've been keeping an eye on ZippyJSON for a while. Being able to speedup Disk reads as well would be a serious +1 for switching.

@idolize
Copy link

idolize commented Jan 9, 2024

Yeah, I'm interested in using https://github.com/christophhagen/BinaryCodable for larger file writes.

@idolize
Copy link

idolize commented Feb 14, 2024

FYI for those interested - I made a fork here that allows you to conform any custom encoder/decoder to the DiskEncoder or DiskDecoder protocols and use those instead with any of the built in Disk functions.

@michaeleisel
Copy link
Author

What about the TopLevelDecoder protocol, can we leverage that here

@idolize
Copy link

idolize commented Mar 1, 2024

@michaeleisel it's probably possible, but I had issues getting the compiler happy when I tried (admittedly I didn't spent a lot of time on it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants