Code Monkey home page Code Monkey logo

Comments (2)

ezrosent avatar ezrosent commented on May 18, 2024 3

This looks cool! Thanks for the links. When I get the chance I'll add these into the benchmarks (comparing Go to Go and Rust to any C/C++ implementations that may exist). Keep in mind that there a few senses in which these aren't apples-to-apples comparisons:

  • It doesn't look like the Go implementation supports sending arbitrary types over a channel; the channels here (at least in Go) box their values, making many things slower. If this were implemented in the Go runtime, it could potentially be faster.

  • The Go implementation essentially busy-waits (it does for ... { runtime.GoSched() }) when readers have out-run writers. This probably makes microbenchmarks perform better, but it seems wasteful for the case where a writer may just not be ready to send a value. Having a more principled blocking strategy where you just block until the writer is ready seems more reasonable; which is what we do here. It looks like there are many such "waiting strategies" supported in the original paper. As a result of this (and possibly also the underlying algorithm) I suspect that the go implementation will perform a bit better than the bounded channels here.

  • Correct me if I'm wrong here (I've only skimmed the paper) but the Disruptor structure seems to target "communication graphs" with a small number of producers or consumers; the aim for the data-structures in this repo is to support (and scale with) arbitrary producers and consumers. Last time I ran some benchmarks on the Rust implementation (which is more optimized than the Go one), I think it performed worse at lower producer/consumer counts, but performed similarly or better at higher ones compared to the paper (which admittedly uses a Java implementation). It also seems to have a different API than a standard concurrent queue, which may make apples-to-apples comparisons difficult.

  • The aim of the data-structures here is to support the full Go channel semantics. Among other things, this means supporting select (see 81099c5). While it may be possible to use a ring-buffer-like structure to support select, it isn't obvious to me how to do it. I'll post back here if it occurs to me in the meantime.

Does that sound reasonable to you?

P.S: The Rust implementation I'm talking about isn't the one on the rust_impl branch right now; but it will be posted soon.

from fchan-go.

samuell avatar samuell commented on May 18, 2024

Many thanks for the detailed explanations @ezrosent

I'm really quite new to all of this. Still learning.

from fchan-go.

Related Issues (1)

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.