Jump to content
  • Advertisement
Sign in to follow this  
choffstein

Serialization vs. Marshalling vs. Pickling

This topic is 4074 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I often here these terms used interchangeably ... is there a technical difference? As far as I can tell, the serialization interface tends to be designed by the programmer in a format, where marshalling and pickling are implemented in the language themselves ... Thanks

Share this post


Link to post
Share on other sites
Advertisement
For all practical purposes, they are the same.

Serialization is usually used when it refers to unspecified use of converting structures into stream of data.

Marshalling is generally used for serialization of methods or other forms of remote function calls.

Pickling is something that's simply language specific.

There are no interfaces or anything here. Serialization is a process. Just like compilation or linking.

Another thing about serialization is that it's different from persistence. Serialization is intended for short-term, transient data, or very local data (a single struct).

Contrary to this is persistence, which is designed for long-term storage. While sometimes mixed, serialization tends to be lightweight, carrying little to no context information. Persistence is usually larger, involves more complex constructs, and relies on full contextual information to make data reconstructible under different circumstances (different code-base, platform, application, format, ...).

All of these however are intended for specific uses. When requiring data exchange between different domains, portable or standard formats are used. They don't fall under any of these categories, since in that case, what is written does not need (actually, it must not) be a 1:1 representation of application specific knowledge.

Persistence and serialization are generally efficient, and represented in application/language/platform friendly manner, rather than human/portable form.

Share this post


Link to post
Share on other sites
My understanding is that these words can mean slightly different things given the context, but generally they are:

1.) Serialization: The process of writing an object to disk, or loading it from disk.

2.) Marshalling: I first came across this in the context of the .NET language and is used to refer to the process of converting between data types. Specifically I have used this when converting between managed and native data types.

3.) Pickling is soaking something in vinegar to preserve it. Picking (Read: Pick-ing) is not a language specific anything. It's the process of checking whether a point in screen space intersects with a polygon in world space. Imagine moving your mouse around a screen full of 3d stuff and you want to click on one of them - the process of finding out what you clicked on (if anything) is called picking.

Share this post


Link to post
Share on other sites
In a given context there may be a technical difference. For example, in Python pickling and marshaling usually refer to actions done by the pickle and marshal modules, which (oversimplification) are serialization modules for two different purposes. Whereas in .NET marshaling generally refers to interop between managed and unmanaged types and serialization usually refers to sending/storing objects over a stream.

However, if you mean in general computer science definition terms, they pretty much mean the same thing.

Share this post


Link to post
Share on other sites
something else to think about:

serializing usually just simply 'flattens' the object (and its children if they exist) into a series of bytes that can be sent to a stream (network, disk, etc.)

marshalling, at least in my experience, involves convering from low-level, raw, 'unrefined' data into high-level, strictly type-checked objects.

for example, for mashalling data from an XML file into an object, it usually involves checking the XSL to detect whether properties and attributes have valid values, while a simple xml deserializer, would just create the objects regardless of the data in them.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!