Coder Social home page Coder Social logo

Comments (2)

leesper avatar leesper commented on August 17, 2024

嗯嗯,我也发现这个问题了,所以我在util.go里面写了一个ConnectionMap来管理客户端连接,它其实就是map加读写锁,所以效率较低。ConcurrentMap因为有死锁的bug,暂时没有使用,Github上有个项目go-concurrentMap,是高仿Java的ConcurrentHashMap,从测试数据来看效率非常高,如果你感兴趣可以看下,但实现很复杂,几乎是将Java的实现搬到Go来了,因为两种语言的内存模型不太一样,我没敢搬过来直接用,ConcurrentMap我还没来得及改,sorry

from tao.

leesper avatar leesper commented on August 17, 2024

我能想到的一个折中的方法,就是先IterKeys()把所有的key遍历一遍,放到slice中,然后遍历slice,再逐个删除

from tao.

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.