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

Recommend GHCJS serialization library #547

Open
johannesgerer opened this issue Oct 19, 2019 · 6 comments
Open

Recommend GHCJS serialization library #547

johannesgerer opened this issue Oct 19, 2019 · 6 comments

Comments

@johannesgerer
Copy link

Could reflex-platform devs/users share their experiences with different serialization libraries?

Is there a clear winner?

Thanks

@3noch 3noch changed the title Recommend GHCJS serialization librarty Recommend GHCJS serialization library Dec 13, 2019
@3noch
Copy link
Member

3noch commented Dec 13, 2019

That's a bit hard to answer as is. What kind of serialization use case do you have in mind?

@johannesgerer
Copy link
Author

For example a Haskell REST Api serving Haskell data structures to a GHCJS powered client.

@johannesgerer
Copy link
Author

johannesgerer commented Feb 17, 2020

I settled for persist after consulting this
benchmark, and excluding platform-dependent encoding and flat which could not be compiled on reflex-platform's GHCJS out-of-the-box.

I also tested browsers JSON.parse followed by fromJSVal_aeson, but only saw 2x speedup and ended up preferring the non-FFI solution.

I see significant 10x speedups in my usecase where GHCJS-compiled JS requests Haskell Values generated on and to be serialized by a Haskell server and de-serializes it back into Haskell values.

Deserialization time went from 4s using Aeson (4MB serialized JSON) down to 0.4s when using Persist (3MB serialized).

@3noch
Copy link
Member

3noch commented Feb 17, 2020

Wonderful data! Thanks!

@3noch
Copy link
Member

3noch commented Feb 17, 2020

To clarify, you found that persist was fastest but persist uses a binary format. You mention that your usecase uses JSON. I don't understand how persist helps here.

@johannesgerer
Copy link
Author

You are right, see my updated response

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