{"id":45447454,"url":"https://github.com/iamjinlei/goringbuffer","last_synced_at":"2026-02-22T04:05:08.692Z","repository":{"id":57512349,"uuid":"170632389","full_name":"iamjinlei/goringbuffer","owner":"iamjinlei","description":"Ringbuffer with concurrent insertion and Iteration support","archived":false,"fork":false,"pushed_at":"2020-03-26T08:07:07.000Z","size":71,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-15T06:46:17.634Z","etag":null,"topics":["golang","lockless","ringbuffer"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iamjinlei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-14T05:25:13.000Z","updated_at":"2020-03-26T08:07:09.000Z","dependencies_parsed_at":"2022-09-26T17:51:38.553Z","dependency_job_id":null,"html_url":"https://github.com/iamjinlei/goringbuffer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iamjinlei/goringbuffer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamjinlei%2Fgoringbuffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamjinlei%2Fgoringbuffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamjinlei%2Fgoringbuffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamjinlei%2Fgoringbuffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iamjinlei","download_url":"https://codeload.github.com/iamjinlei/goringbuffer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamjinlei%2Fgoringbuffer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29704420,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T03:17:42.375Z","status":"ssl_error","status_checked_at":"2026-02-22T03:17:31.622Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","lockless","ringbuffer"],"created_at":"2026-02-22T04:05:08.628Z","updated_at":"2026-02-22T04:05:08.683Z","avatar_url":"https://github.com/iamjinlei.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/iamjinlei/goringbuffer.svg?branch=master)](https://travis-ci.com/iamjinlei/goringbuffer)\n\n# Ring Buffer\n\nA simple thread safe ring buffer implementation that supports add and iterate operation. The position in ring buffer does not necessarily indicate data freshness at the tiem when data are added concurrently, but eventually would. An example of such scenario:\n\n\nAssume we have following ring buffer\n\n```\n+----+----+----+----+----+----\n| p0 | p1 | p2 | p3 | p4 |\n+----+----+----+----+----+----\n```\n\n\nAnd the code is\n\n\n```\nr := goringbuffer.New(10)\ngo r.Add(100) // to p0 with old value 10\ngo r.Add(200) // to p1 with old value 20\nsum := []int{0}\ngo r.Do(func(e interface{}){\n   sum[0] += e.(int)\n})\n```\n\nEven though the above code may settle 100 into p0 and 200 into p1 eventually, sum[0] may be 30 (10 + 20), 300 (100 + 200), 210 (10 + 200) or 120 (100 + 20).\n\n# Perf\n\nIntel Core i5 2.3GHz\n\n#### size = 16\n```\nBenchmarkAdd-8          50000000                36.1 ns/op\nBenchmarkDo-8           20000000                104 ns/op\n```\n\n#### size = 64\n```\nBenchmarkAdd-8          30000000                36.7 ns/op\nBenchmarkDo-8            5000000                322 ns/op\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamjinlei%2Fgoringbuffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamjinlei%2Fgoringbuffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamjinlei%2Fgoringbuffer/lists"}