Git Product home page Git Product logo

Comments (2)

buybackoff avatar buybackoff commented on May 14, 2024 1

BufferManager is not the best option, even it's namespace suggests it is intended for particular purpose.

There is shared memory pool optimized for thread local and detecting memory pressure, but it could return size larger than requested, that breaks RMS in the current design and requires a check for length. If the goal is to reduce overall app memory usage and share pools then using the shared pool with the check should be OK, or RMS should be redesigned to use ArraySegments/Memory etc.

There is also a ConfigurableArrayPool but the relevant variable to get exact size MaxBucketsToTry is not configurable. It should be set to zero and != condition in the while loop replaced with <=.

RMS could just extract bucket implementation from ConfigurableArrayPool, it is c.3X faster than ConcurrentStack that is used now. Replacing SpinLock with hand-crafted lock makes it even faster and is appropriate for this case where the work being done inside the lock is literally a couple of instructions.

from microsoft.io.recyclablememorystream.

imanushin avatar imanushin commented on May 14, 2024

@buybackoff , thank you for detailed investigation.

RMS should be redesigned to use ArraySegments/Memory etc.

I think this is the best option, because we will re-use common solution (which is optimized for now and will be optimized in future).

And I fully agree with "BufferManager is not the best option" according to your arguments

from microsoft.io.recyclablememorystream.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.