Giter VIP home page Giter VIP logo

Comments (5)

FlorianKirmaier avatar FlorianKirmaier commented on July 3, 2024

I think you should provide a class hierarchy, with a description of how you create the "picklers".
Otherwise, no one can help you.
My first guess would be, that macro-generated picklers behave differently (if they still work with scala3).

from boopickle.

strelec avatar strelec commented on July 3, 2024

I think the difference is how value classes are serialized (extends AnyVal).

from boopickle.

strelec avatar strelec commented on July 3, 2024

Figured it out. Minimal example:

case class B(p1: Seq[Int])
Pickle.intoBytes(B(Seq(10, 20, 30, 40)))

Scala3 does not output the extra zero at the begining:

Scala 2: 0, 4, 10, 20, 30, 40
Scala 3: 4, 10, 20, 30, 40

from boopickle.

strelec avatar strelec commented on July 3, 2024

Actually, I changed my mind.

I find the Scala 3 format much better. It is about 20-30 percent more efficient, due to skipping of those useless zero bytes.

Let's keep the Scala 3 format, as it is more efficient and easier to write custom decoders. Scala 2 is going to be phased out soon enough.

from boopickle.

strelec avatar strelec commented on July 3, 2024

One more difference. For sealed trait hierarchies:

Scala 2 encodes with a starting tag "1" the first child that comes alphabetically by name.
Scala 3 uses a tag "1" for the class that appears in the file first.

Scala 3 again much better, since it is common to rename things, but not so common to move them around.

from boopickle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.