GithubHelp home page GithubHelp logo

Comments (2)

jamescourtney avatar jamescourtney commented on June 8, 2024

You can specify multiple serializers in the XML:

     <FlatSharpDeserializers>GreedyMutable;Progressive</FlatSharpDeserializers>

This will apply globally. You'll get (slightly) more code than you perhaps bargained for. You could put your progressive table in a separate .csproj, which might reduce the volume of code depending on how simple the one progressive table is. It's also possible it goes the other way and increases your net lines of code. Happy to explain why if you're curious.

FlatSharp could support the case you are describing, which would involve traversing the dependency graph to determine which types are dependents of the given root type, then overriding the generated serializers property for those types, etc. FlatSharp does this already for cycle detection to avoid emitting recursion depth checks for non-cyclical schemas. This is a medium sized chunk of work that I'm happy to add as a feature request, though I can't promise I'll get to it on any schedule.

Lines-of-code seems like a persistent issue for you, so let me set some context about why FlatSharp does what it does. Most people using FlatBuffers do so because they have performance needs that aren't met by other formats/libraries. It follows that FlatSharp generates code with the goal of generating C# that the JIT can translate into efficient assembly. Due to some decisions by the JIT, this sometimes requires generating more code than you would write if implementing things by hand with the goal of avoiding virtual method calls, generic method sharing, etc. The main changes to generated code size can be found in the release notes for 7.0.0 and 7.1.0.

HTH,
James

from flatsharp.

duckdoom4 avatar duckdoom4 commented on June 8, 2024

Yeah the goal was to not add the additional code generation for those files that didn't need it and ideally we wouldn't have to create a seperate project for this specific file.

We have like 100 fbs files in one project so the small bits of extra code quickly add up to a lot of extra code. As we've seen before, that slowed down compilation times and introduced IDE lag so we'd like to avoid adding more then needed.

That said, since it's already much better than is was before the new changes were introduced it's probably okay to enable it globally for the project that needs it. So that's what we'll do for now.

from flatsharp.

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.