Replies: 1 comment
-
Both things you mentioned should be possible. Someone would need to work on it, but there arent any technical blockers |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
The ergonomics (
... derives ReadWriter
) ofupickle
have become very good, as I've migrated from Scala 2.13 to Scala 3.5.For my browser <-> server API I had been using
boopickle
, which unfortunately does not really seem to be supported anymore and has an annoying runtime-only bug with nested sealed traits on Scala 3, which asupickle
shows should not be an issue in modern Scala versions.There are a couple of things where
boopickle
, for this particular purpose, and of course only IMHO, has some nice features, and I was wondering if these would be possible to implement inupickle
. I'd be willing to take a stab at it but don't know where to start.Specifically:
If my API uses
upickle
the resulting Javascript bundle size is about 1,5 megabytes larger than when usingboopickle
(for about ~1500 types). I don't know if code size is at all a consideration, but I wonder what is possible to improve on this. Despite the new module optimizations inscala-js
this increase still hurts as picklers tend to clump together due methods operating on[T : ReadWriter]
.boopickle
uses the implicit index/order of the fields to populate an object. This is a great feature as it cuts down on the network traffic (if I send 10,000 books in a List, I don't need to repeat "title" 10,000 times, "date" 10,000 times, and so on, if I simply know that forBook
the first field is the title and the second is the date), and also obfuscates somewhat (instead ofmyapp.usertype.admin
it would just have1
as that is its index in the type definition).Since
upickle
supports bothjson
andmessagepack
, I wonder how hard it would be to create a new serialization format that uses the implicit order of fields (thus requiring client and server to be based on the same definitions) ? I imagine this gets challenging with trait inheritence etc, but I can't really judge this myself.Boopickle
also deduplicates and sizes-optimizes encodings, but this is, for me, less important. I'd like to mostly avoid using and repeating the key names, and am always interested in reducing generated code size.Beta Was this translation helpful? Give feedback.
All reactions