You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm tweaking my custom serializer right now. We use netcoreapp3.1 and will update to net6.0 if it is released in November. And since RabbitMQ.Client library exposes ReadOnlyMemory<byte> as a payload would be useful to read it right from the memory without allocating string or array first. Therefore speaks nothing against using Span and Memory in our custom implementation, if not in Utf8Json itself yet.
I've heard in some comments somebody has already a fork with a customized writer/reader, which we could reuse?
JsonReader.ReadPropertyNameSegmentRaw() allocates a string, which will be not used by instantiating of object. Ideally, I would compare the array range with the expected property name string and just advance the offset. Does anybody already uses this way JsonReader.ReadStringSegmentRaw() and JsonReader.ReadPropertyNameSegmentRaw() in your serializers? The latter messed up the offset in my test and I can't figure out why.
how do you check whether the property name is right else?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I'm tweaking my custom serializer right now. We use
netcoreapp3.1and will update tonet6.0if it is released in November. And sinceRabbitMQ.Clientlibrary exposesReadOnlyMemory<byte>as a payload would be useful to read it right from the memory without allocating string or array first. Therefore speaks nothing against usingSpanandMemoryin our custom implementation, if not inUtf8Jsonitself yet.JsonReader.ReadPropertyNameSegmentRaw()allocates a string, which will be not used by instantiating of object. Ideally, I would compare the array range with the expected property name string and just advance the offset. Does anybody already uses this wayJsonReader.ReadStringSegmentRaw()andJsonReader.ReadPropertyNameSegmentRaw()in your serializers? The latter messed up the offset in my test and I can't figure out why.Beta Was this translation helpful? Give feedback.
All reactions