Giter VIP home page Giter VIP logo

Comments (4)

Darksonn avatar Darksonn commented on June 7, 2024

Perhaps the most important part missing in being production-ready is an intention to support the project in the future. If someone reports an issue with this project, and we don't believe actually fixing it would improve the project in the direction of being a learning resource, it might just turn into another one of those comments you mentioned.

As for your lru frame, it seems like the parsing spends the majority of the time inside a call to Bytes::copy_from_slice.

from mini-redis.

photoszzt avatar photoszzt commented on June 7, 2024

Looking at the code,

let data = Bytes::copy_from_slice(&src.bytes()[..len]);
this is the only place that uses the function. Is there any way to optimize this part?

from mini-redis.

Darksonn avatar Darksonn commented on June 7, 2024

You would have to change several other parts of the codebase to elide that copy if it's possible at all.

from mini-redis.

photoszzt avatar photoszzt commented on June 7, 2024

I try to make the parsing code without copy:
https://github.com/photoszzt/cache_server/blob/522a2fc3fcb8ba57fd7e24a7505b41cd60a0321e/src/frame.rs#L274-L332
I change the parse in connections.rs to https://github.com/photoszzt/cache_server/blob/522a2fc3fcb8ba57fd7e24a7505b41cd60a0321e/src/connection.rs#L102-L132

My modified version records the start and end position in the slice and uses split_to and freeze to get Bytes from BytesMut.
But I find that this modification is leaking memory. I'm running a workload that inserts key/value and deletes them. The one that uses copy_from_slice doesn't leak memory. Is there anything wrong on this modification?

from mini-redis.

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.