Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8381471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:42:30+00:00 2026-06-09T16:42:30+00:00

We are using protobuf-net to serialize and de-serialize deep object graphs. Some members of

  • 0

We are using protobuf-net to serialize and de-serialize deep object graphs. Some members of these
graphs are really repeated over and over across many graphs, as is the case for many-to-one relations to a few objects. For example, a Sale object would be a graph, and its Store member
(possibly a sub-graph on its own) would be only one out of 10 possible stores, and thus it would be
repeated over and over across many messages (Sale graphs).

We could reap obvious performance benefits if we could somehow cache the serializations of these objects. Ideally, we would like to tell the RuntimeModel that certain types – in this case, Store – should be handled through an extensibilty point, much like surrogates, which would however we capable of providing the raw serialization bytes.

One of our constrains is that the generated messages should still be protobuf-net compatible, in
order to be parsable directly by clients in other platforms (say, Python) without these “hooks”
(screw performance optimizations for Python clients!).

We looked at surrogates, but it looks that whatever the surrogate produces (in our case that would
be somehow a byte[] array) would (as you’d expect) still be serialized as its type (i.e. as a
byte[] array) and thus not compatible with the Store object expected by Python clients.

We also looked at Extensions, and even if we somehow hacked the cached serialized Store in an
extra field, we’d back to square one with Python clients.

Is there any other extensibility mechanism we might use for this scenario?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:42:31+00:00Added an answer on June 9, 2026 at 4:42 pm

    Ooh, interesting. Indeed, the python requirement derails what I was going to say (reference tracking). What you could do is to serialize those first to a byte[] each (via MemoryStream) and then just include that data as a byte[] member (there is no difference between a byte[] and the original object – external clients won’t notice any differenc), but the thought occurs that in most cases this is not going to be significant faster than just keeping the object model “as is” and serialising some of the nodes multiple times (the serialization is not very slow).

    Frankly, though, I would be looking at storing it a different way – so instead of storing stores as a child node, I’d have them uniquely once as top-level nodes, and just store some unique identifier as a lookup (not the child-object itself). That changs the layout, though.

    No, nothing is built in to support this, and I’m not sure it is a key-scenario for supporting.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Protobuf.net to serialize some classes. I would like to be able
I'm using protobuf-net (thanks Marc :) ) to serialize my object model, but I
I've a problem with serializing an object using protobuf.net. I've used it on other
I'm trying to serialize a model using the great Protobuf-NET. I cannot use the
using protobuf-net.dll Version 1.0.0.280 When I deserialize a DateTime (wrapped in an object), the
Protobuf-Net 2.0.0.480 can serialize structs using either the DataContract or ProtoContract attribute, and is
Is it possible to (de)serialize a POCO type using neither protobuf-net attributes nor explicitly
Is it possible to serialize a byte array using protobuf-net and then send it
I'm trying to serialize some objects with protobuf-net , but unfortunately they make liberal
I have a class that I serialize, then deserialize using Protobuf-net version r431 (probably

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.