Code Monkey home page Code Monkey logo

ring's Introduction

This pkg implements a non-thread safe ring buffer for buffering a byte stream

A ring buffer is useful in situations where you need a buffered reader. Once allocated a ring buffer does not need to allocate additional memory or move bigger junks of data around.

Benchmarks

These are simple benchmarks which calculate an average throughput of data per second.

BenchmarkChannelWithValueImpl 6184.24 MB/s

A ring buffer based on sending arrays of data.

BenchmarkChannelWithPtrImpl 249005.02 MB/s

A ring buffer where the written data is probably not copied because its throughput is incredibly high.

BenchmarkSliceMovingImpl 11.85 MB/s

A ring buffer implementation based on moving data after reading data it.

BenchmarkSliceWithAllocationImpl 1296.94 MB/s

A ring buffer based on reallocating memory.

BenchmarkRingImpl 32184.91 MB/s

The ring buffer in this package.

Conclusion

If copying data is not needed when writing it, the channel implementation is unbeatable. If copying data on write is needed then this ring buffer implementations can probably be recommended.

If you find obvious flaws here please let me know.

ring's People

Contributors

komkom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.