Code Monkey home page Code Monkey logo

Comments (2)

thesamet avatar thesamet commented on June 22, 2024

Thanks for posting. Can you add to the proposal the following:

  • how the duplicator will be selected?
  • Would having a deduper require the field to be lazy evaled (as in #1373)?
  • Can deduping made optional in the generator?
  • Should it impact instantiation outside binary deserialization: fromPMessage (JSON, Spark)

from scalapb.

ya-goodfella avatar ya-goodfella commented on June 22, 2024

how the duplicator will be selected?

One of the options - provide a name of class, that implements DeduplicatorProvider interface:

trait DeduplicatorProvider {
  def getOrCreateDeduplicator[T: ByteStringCodec]: Deduplicator[T]
}

This name may be provided on generator, package, file or even field level.

Would having a deduper require the field to be lazy evaled (as in #1373)?

Actually they are related, but not tight coupled. You may want to reduce memory footprint of common objects even if they are eagerly parsed.
So, if you deserialize some string or message type, you may pass your already delimeted ByteString to Deduplicator and check the cache presence by ByteString hashing / comparision.

Can deduping made optional in the generator?

Sure, it may be done completely optional on any configuration level.
Also, I also found useful to disable it at for some field - like we have a case, where there is some string description field, which doesn't contribute anything for business logic, but will pollute the strings cache if we will try to deduplicate it. Ideally I would prefer to keep this field lazy & non-cacheable.

This may be achieved by checking the presense of deduplicate field / message option and disable it for field which shouldn't be cached.

Should it impact instantiation outside binary deserialization: fromPMessage (JSON, Spark)

I think so.

from scalapb.

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.