GithubHelp home page GithubHelp logo

message.Encode optimization about bcache HOT 4 CLOSED

iwanbk avatar iwanbk commented on July 16, 2024
message.Encode optimization

from bcache.

Comments (4)

yogyrahmawan avatar yogyrahmawan commented on July 16, 2024

I think for entries , we can keep using map because :

  1. Insertion on map would take O(1) and slice would take O(n)
  2. Getting data on map would take O(1) and slice would take O(n)

So for performance, I think it would be good if we keep using map data structure instead ofslice

from bcache.

iwanbk avatar iwanbk commented on July 16, 2024

So for performance, I think it would be good if we keep using map data structure instead ofslice

Please note that this is more about encoding performance.

Insertion on map would take O(1) and slice would take O(n)

hmm..yes, insertion operation performance will affect.
do you have any data that map is faster than slice?

Getting data on map would take O(1) and slice would take O(n)

we can exclude this, there is no get operation on the message

from bcache.

yogyrahmawan avatar yogyrahmawan commented on July 16, 2024
we can exclude this, there is no get operation on the message

Oh my bad

hmm..yes, insertion operation performance will affect.
do you have any data that map is faster than slice?

Since someone already did benchmark on map vs slice in this ref : https://shakedos.com/maps-vs-slices-vs-arrays, I revoked my statement. For insertion, slice is faster than map.

So I agree for changing from map to slice

from bcache.

iwanbk avatar iwanbk commented on July 16, 2024

did some profiling, with this scenario:

  • 40 concurrent key set, with 4K of total keys
  • sleep for 2 seconds
  • 40 concurrent key get, with 4K of total keys
  • repeat forever

max keys is 100K.

There is no sign of issue in message.Encode performance.
So, i think we don't need optimization on this thing, at least for now.

cpu.pdf
heap.pdf

from bcache.

Related Issues (12)

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.