Giter Club home page Giter Club logo

go-left-right's People

Contributors

csimplestring avatar mikkelhjuul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

go-left-right's Issues

[Discussion] readerIndicator is not conclusively faster than RWMutex

Hi,

I tried rewriting the project but used a linked left-right approach. also I thought the readerInicator looked a lot like an RWMutex, so I tried with that in stead.

I think the resulting code is a lot more readable: linked-left-right

But I also found that this solution performed quite a lot better in moderate load situations (break-even about 50 goroutines)

your master branch:

goos: linux
goarch: amd64
pkg: github.com/csimplestring/go-left-right
cpu: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
BenchmarkLRMap_Write-8                   9962917               111.4 ns/op
BenchmarkLockMap_Write-8                18546358                62.40 ns/op
BenchmarkLRMap_Read-8                    3806511               272.0 ns/op
BenchmarkLockMap_Read-8                  6499641               170.4 ns/op
BenchmarkLRMap_Read_Write_5_1-8             1575            812337 ns/op
BenchmarkLockMap_Read_Write_5_1-8           1669            675591 ns/op
BenchmarkLRMap_Read_Write_10_1-8            1281           1380485 ns/op
BenchmarkLockMap_Read_Write_10_1-8          1042           1107362 ns/op
BenchmarkLRMap_Read_Write_50_1-8             531           2365397 ns/op
BenchmarkLockMap_Read_Write_50_1-8           268           4396724 ns/op
BenchmarkLRMap_Read_Write_100_1-8            331           3951561 ns/op
BenchmarkLockMap_Read_Write_100_1-8          136           8815394 ns/op
BenchmarkLRMap_Read_Write_500_1-8             70          15398926 ns/op
BenchmarkLockMap_Read_Write_500_1-8          139           8690447 ns/op
PASS
ok      github.com/csimplestring/go-left-right  31.352s

my branch MikkelHJuul/linked-left-right:

goos: linux
goarch: amd64
pkg: github.com/csimplestring/go-left-right
cpu: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
BenchmarkLRMap_Write-8                   9037975               124.6 ns/op
BenchmarkLockMap_Write-8                19078170                61.88 ns/op
BenchmarkLRMap_Read-8                    4329091               248.6 ns/op
BenchmarkLockMap_Read-8                  6337088               182.4 ns/op
BenchmarkLRMap_Read_Write_5_1-8             3476            359224 ns/op
BenchmarkLockMap_Read_Write_5_1-8           1406            801319 ns/op
BenchmarkLRMap_Read_Write_10_1-8            2132            548529 ns/op
BenchmarkLockMap_Read_Write_10_1-8          1041           1186699 ns/op
BenchmarkLRMap_Read_Write_50_1-8             526           2256797 ns/op
BenchmarkLockMap_Read_Write_50_1-8           290           4430084 ns/op
BenchmarkLRMap_Read_Write_100_1-8            254           4453970 ns/op
BenchmarkLockMap_Read_Write_100_1-8          148           8315832 ns/op
PASS
ok      github.com/csimplestring/go-left-right  29.527s

It's a fun data structure to work with :)

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.