Comments (7)
It helps dynamic object serialization, but your case looks like unintended one. Auto generated serializer should not use PackObject in usual cases, so it seems to be a bug.
Would you show me what type(s) actually packed?
from msgpack-cli.
The exact object being serialized is a Dictionary<string, List<object>>
. The object being deserialized is an instance of:
class MsgToDeserialize {
double[] Results;
string error;
}
I am working on putting together some code that exhibits the problem for you.
from msgpack-cli.
The reason of Packer.PackObject
is that you use Object
type instead of MsgToDeserialized
type for item type of the list. The serializer generator uses on-the-fly evaluation to handle actual type of Object
items in a list.
I wonder why do you use List<object>
instead of MsgToDeserialize
, but I will wait for your additional code.
Thank you!
from msgpack-cli.
The messages in each direction are not the same. This is a request/reply RPC system.
The request is a Dict mapping from strings to a list of either int, float, double or string. (So the variable type kinda has to be List<object>
, since one key in the dictionary can point to a list of strings and another to a list of ints.)
The reply is either an error message, or a list of double. Does it make a bit more sense now?
from msgpack-cli.
Here is a .cs file with a short program that exercises all the code paths I am using in the MessagePack C# library: https://gist.github.com/chrish42/e975c355f4118ebe2e70
Thanks for looking into this!
from msgpack-cli.
Thank you.
If you use only primitive type or its collection only, you can use List<MessagePackObject>
instead of List<Object>
. It improves performance about 1000 times faster in my local test because the serializer does not have to attempt complex object tree serialization.
You can find API document here:
http://cli.msgpack.org/doc/html/T_MsgPack_MessagePackObject.htm
If you need more sample code snippets for MessagePackObject
handling, it is better to post to issue 13 rather than this post :-)
I will improve the wiki to notice this performance pit anyway. Thanks!
from msgpack-cli.
The change to MessagePackObject
fixes the performance problems, thanks. Happy to hear you will also be improving the documentation with respect to this. Also, for people who do need complex object tree serialization for List<object>
, etc. a LRU cache of the results for compile()
in the packToCore()
function might help a lot in cases when the same small number of complex objects a serialized a lot. Just a suggestion...
Closing this issue, as the switch to MessagePackObject
fixes my performance problems with MessagePack. Thanks again for your time. Much appreciated.
from msgpack-cli.
Related Issues (20)
- Add a non-generic override to SerializerRepository
- EnumMemberAttribute does not work. (expectedly)
- Type Object in MessagePack HOT 1
- GetMemberName() causes NullReferenceException when using MessagePackSerializer.Get<T>() in Xamarin iOS
- [Unity][il2cpp]'class' is not registered in this resolver,resolver.StandardResolver HOT 2
- How to serialize and deserialize a List member in a class HOT 2
- Problem deserializing byte array - InvalidOperationException caused by Decoders.InvalidArrayHeader.Read call HOT 4
- about LZ4 HOT 1
- Unable to cast object of type on netcore HOT 1
- Custom Serialisation docs appear to be out of date. HOT 1
- PackAsync & UnpackAsync not working when passing data continuously using for loop c# HOT 1
- The unpacked value is not expected type HOT 2
- Authenticode Signing? HOT 2
- DateTime serialization and deserialization timezone HOT 3
- Enum Deserialization Not working? HOT 1
- Serializer.Unpack Continuosly Stream of Data => High Memory Usage HOT 3
- Serialization / deserialization speed optimizations HOT 2
- Serialization field order by declaration order HOT 3
- Add additional TFM do dependencies can be optimised HOT 2
- Set additional package metadata
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from msgpack-cli.