Big Thanks to Marc for helping me with this offline!!!
On Tuesday, March 26, 2019 at 11:32:53 AM UTC-7, Shweta Sharma wrote:
>
> I am prototyping an application to store data in redis using
> StackExhange.Redis client. I am using Protobuf for serializing my objects
> and storing them as key/value pair in redis. When reading 20K keys using
> pipeline (splitting keys in batches of 5000), I observe deserialization
> times in 60-300 ms for a batch of say 5000 objects. Serialization code is
> using protobuf-net library version. Deserialization code is using
> protobuf-net 2.4.0.0.
>
> Is there anyway I can speed up desrialization time since this will impact
> my api performance.
>
> The object I am trying to desrialize is not too complex.
>
> [ProtoContract]
> public struct MyObject
> {
> [ProtoMember(1)]
> public int Key { get; set; }
> [ProtoMember(2)]
> public byte Attr1 { get; set; }
> [ProtoMember(3)]
> public bool IsUsed { get; set; }
> [ProtoMember(4)]
> public byte Attr2 { get; set; }
> [ProtoMember(5)]
> public SubObj[] SubObjects { get; set; }
>
> public static MyObject Null
> {
> get
> {
> return default(MyObject);
> }
> }
>
> public bool IsNull
> {
> get { return Attr1 == default(byte) && SubObjects == null; }
> }
> }
> [ProtoContract]
> public class SubObj
> {
> [ProtoMember(1)]
> public int StartOffset { get; set; }
> [ProtoMember(2)]
> public int EndOffset { get; set; }
> [ProtoMember(3)]
> public byte Attr1 { get; set; }
> [ProtoMember(4)]
> public byte Attr2 { get; set; }
> [ProtoMember(5)]
> public bool IsUsed { get; set; }
>
> public static SubObj Null
> {
> get
> {
> return default(SubObj);
> }
> }
>
> public bool IsNull
> {
> get { return Attr1 == default(byte); }
> }
> }
>
> Here're some sample timings using StopWatch:
>
> Time to desrialize 5000 keys from redis:134
> Time to desrialize 5000 keys from redis:147
> Time to desrialize 5000 keys from redis:160
> Time to desrialize 5000 keys from redis:65
> Time to desrialize 5000 keys from redis:67
> Time to desrialize 5000 keys from redis:242
> Time to desrialize 5000 keys from redis:371
> Time to desrialize 5000 keys from redis:190
>
> Thanks,
> Shweta
>
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.