-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing the dependency on Microsoft.IO.RecyclableStream and improving serializer performance #349
Removing the dependency on Microsoft.IO.RecyclableStream and improving serializer performance #349
Conversation
Hi @stebet , this looks glorious 😍 Will carefully look into it this evening or tomorrow and will ping back. Thanks! |
I'm looking at a few test issues, I'll let you know as soon as I'm done figuring them out :) |
Co-authored-by: Jody Donetti <[email protected]> Co-authored-by: Stefán Jökull Sigurðarson <[email protected]>
Hi @stebet , I run the benchmarks on my machine, and the results seem to be consistent. Here are the main results. CysharpMemoryPack (Serialize)
CysharpMemoryPack (Deserialize)
NeueccMessagePack (Serialize)
NeueccMessagePack (Deserialize)
SystemTextJson (Serialize)
SystemTextJson (Deserialize)
As you can see for System.Text.Json I also added the version with the I also added a version that used I'm thinking that we may see advantages in using the I'd say to just go with the Thanks for this PR! |
Also, I need to decide what to do with the On one hand I can just remove it and everything will be slimmer, but then I'd have to also remove the ctor overload that had a param of such type. On the other hand we are talking about V2, which is a major version bump already with some breaking changes, so there's that. In the end what I don't like much is the developer experience of upgrading and having compile-time errors without any specific error message. Pinging @viniciusvarzea whom proposed the Any suggestion? |
From this link: https://medium.com/@epeshk/the-big-performance-difference-between-arraypools-in-net-b25c9fc5e31d "..... So, even staying within the standard pool implementations, for small arrays needed for a short time it is preferable to use the scalable ArrayPool.Shared, and for large arrays a pool created through ArrayPool.Create(..., ...) as more roomy and economical in terms of no separation by threads." |
Hi @sabbadino
Thanks for the link, that's interesting! I'll play with this approach and see how it goes. |
* Add support for raw clear of inner memory cache * Minor NRT stuff * Use collection expressions * Make tagging fully working * Better tagging params for Set method * Refactoring and cleanup * Add sync support for tagging * Add support for GetOrSet without factory + refactoring + better inline comments * Stop casting to FusionCacheBuilder and upgrade IFusionCacheBuilder instead. * Fix with eager refresh (sync version) * Add entry options to RemoveByTag() and Clear() * Add tags to logging * Package update * Add new IncludeTagsInLogs option to... well, I mean... * Add specific skip memory/distributed read/write options * Add support for specific option to skip memory/distributed read/write + better tags entry options support * Better detection + logging when a new Clear() timestamp is detected * Stop suppressing serialization exceptions. Deserialization exceptions instead will keep being suppressable. * Better default value for TagsMemoryCacheDurationOverride option * Better handling of background factory soft fail (eg: ctx.Fail()) * Better tests * More stable Expire + renamed RemoveByTag[Async] to ExpireByTag[Async] to be more clear about the outcome * Add error = true to all [Obsolete] usage * Add tagging support to observability * Change wire format version * Change DataMember names (saves space) * Better Clear (both expire and remove) + added DisableTagging option * Benchmarks stuff * Perf boost * Fix for tagging with eager refresh + tests * Add support for Microsoft HybridCache + tests * Ensure the same builder always returns the same instance + tests * Add immutable types support for AutoClone + add SkipAutoCloneForImmutableObjects option + tests * Better tests * FusionHybridCache tests * Comments * Xml comments * Change Dependency to Microsoft.Extensions.Caching.Abstractions (#341) * Adjust HybridCache dependency (#344) * Fix typo * Update various Microsoft.Extensions.Caching deps to v9.0.0 * Merging Serializer Benchmarks improvements to the v2 branch (#347) * Improving the Serializer benchmarks (#343) * Improving the Serializer benchmark by adding all the serializers and cleaning up the code and config for it. Also added tests for serializing arrays to check for memory pressure on buffers. * Fixing Job config * Minor usings cleanup * Removing the dependency on Microsoft.IO.RecyclableStream and improving serializer performance (#349) * Removing the Microsoft.IO.RecyclableMemory dependency and using ArrayPools instead * Minor cleanup * Cleanup * Add MissingCacheKeyPrefixWarningLogLevel option * More option duplication tests * Add AllowStaleOnReadOnly entry option * Add DangerZone stuff * Benchmarks stuff * Remove reactors for good (replace from a long time by memory lockers) * Better metadata: move LogicalExpiration from metadata to entry and make it a timestamp (long) * Better metadata: switch LastModified from DateTimeOffset to timestamp (long utc ticks) * Better metadata: add Priority * Better metadata priority handling * Organize tests better * Priority tests * Faster tests * Ensure correct timestamp in backplane messages * Make the cross-node Clear timestamp directly precise * Skip distributed cache write and backplane when Tagging expiration timestamp is 0 (zero) * Align sync/async executeCascadeAction usage * Better serialization tests * Better byte array tests * Better metadata surrogate (protobuf-net) member order * Make buffer stuff sealed (small perf boost) + xml docs * Better errors/exceptions for traces (observability) * Better Expire on memory cache * Better TagsDefaultEntryOptions * Minor tag expiration changes * Fix for extra closing curly brace * Better status updates for traces * Minor perf boost * Better tagging * Add support for RemoveByTag with multiple tags * Cross the 1000 tests mark! * Unresolved tension https://xkcd.com/859/ * Minor internal stuff (ToLogString) * Docs * FusionCache v2. Yes, really. --------- Co-authored-by: Jody Donetti <[email protected]> Co-authored-by: Stefán Jökull Sigurðarson <[email protected]> Co-authored-by: Paul Welter <[email protected]> Co-authored-by: Brian Dukes <[email protected]>
Main changes:
Microsoft.IO.RecyclableMemoryStream
and replaces that with implementations based onIBufferWriter<byte>
andArrayPool<byte>
AggressiveInlining
where appropriateIBufferWriter<byte>
instances where applicable etc.)(De)SerializeAsync
methods just call the non-async versions since this never does any I/O so async becomes pure overhead.Runner Information
CysharpMemoryPack
NeueccMessagePack
NewtonsoftJson
ProtoBufNet
ServiceStackJson
SystemTextJson