{"id":30076518,"url":"https://github.com/kelindar/roaring","last_synced_at":"2026-02-26T00:32:31.866Z","repository":{"id":301632396,"uuid":"1006704474","full_name":"kelindar/roaring","owner":"kelindar","description":"Yet another implementation of roaring bitmaps in go","archived":false,"fork":false,"pushed_at":"2025-07-19T20:59:38.000Z","size":6430,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-29T23:56:04.732Z","etag":null,"topics":["bitmap","data-structures","roaring-bitmaps"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kelindar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["kelindar"]}},"created_at":"2025-06-22T20:41:05.000Z","updated_at":"2025-08-08T20:23:25.000Z","dependencies_parsed_at":"2025-06-27T22:32:45.879Z","dependency_job_id":"41735ca7-85b7-4936-b66a-989dd6daf1ec","html_url":"https://github.com/kelindar/roaring","commit_stats":null,"previous_names":["kelindar/roaring"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/kelindar/roaring","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelindar%2Froaring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelindar%2Froaring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelindar%2Froaring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelindar%2Froaring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kelindar","download_url":"https://codeload.github.com/kelindar/roaring/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kelindar%2Froaring/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29845482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T22:37:40.667Z","status":"ssl_error","status_checked_at":"2026-02-25T22:37:25.960Z","response_time":61,"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":["bitmap","data-structures","roaring-bitmaps"],"created_at":"2025-08-08T15:10:05.037Z","updated_at":"2026-02-26T00:32:31.833Z","avatar_url":"https://github.com/kelindar.png","language":"Go","funding_links":["https://github.com/sponsors/kelindar"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\r\n\u003cimg width=\"300\" height=\"100\" src=\".github/logo.png\" border=\"0\" alt=\"kelindar/roaring\"\u003e\r\n\u003cbr\u003e\r\n\u003cimg src=\"https://img.shields.io/github/go-mod/go-version/kelindar/roaring\" alt=\"Go Version\"\u003e\r\n\u003ca href=\"https://pkg.go.dev/github.com/kelindar/roaring\"\u003e\u003cimg src=\"https://pkg.go.dev/badge/github.com/kelindar/roaring\" alt=\"PkgGoDev\"\u003e\u003c/a\u003e\r\n\u003ca href=\"https://goreportcard.com/report/github.com/kelindar/roaring\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/kelindar/roaring\" alt=\"Go Report Card\"\u003e\u003c/a\u003e\r\n\u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg\" alt=\"License\"\u003e\u003c/a\u003e\r\n\u003ca href=\"https://coveralls.io/github/kelindar/roaring\"\u003e\u003cimg src=\"https://coveralls.io/repos/github/kelindar/roaring/badge.svg\" alt=\"Coverage\"\u003e\u003c/a\u003e\r\n\u003c/p\u003e\r\n\r\n## Roaring: Roaring Bitmap for Go\r\n\r\nThis library provides a fast, memory-efficient Go implementation of [roaring bitmaps](https://roaringbitmap.org/), a compressed bitmap data structure for sets of 32-bit integers. It is designed for high-throughput analytics, set operations, and efficient serialization. While most of you should probably use [the original, well maintained implementation](https://github.com/RoaringBitmap/roaring), this implementation uses [kelindar/bitmap](https://github.com/kelindar/bitmap) for its dense implementation, and tries to optimize `AND`/`AND NOT`/`OR`,`XOR` operations. \r\n\r\n- **High Performance:** Optimized for fast set operations (AND, OR, XOR, AND NOT) and iteration.\r\n- **Memory Efficient:** Uses containerization and compression for sparse and dense data.\r\n- **Go Idioms:** Clean, concise API with Go-style patterns and minimal dependencies.\r\n\r\n**Use When**\r\n\r\n- ✅ You need to store and manipulate large sets of 32-bit integers efficiently.\r\n- ✅ You want fast set operations (union, intersection, difference, symmetric difference).\r\n- ✅ You want a dependency-free, pure Go implementation.\r\n\r\n**Not For:**\r\n\r\n- ❌ If you need a mature, and interoperable implementation.\r\n- ❌ Sets of non-integer or non-uint32 data.\r\n\r\n## Quick Start\r\n\r\n```go\r\nimport \"github.com/kelindar/roaring\"\r\n\r\nfunc main() {\r\n    // Create a new bitmap\r\n    bm := roaring.New()\r\n\r\n    // Add values\r\n    bm.Set(1)\r\n    bm.Set(42)\r\n    bm.Set(100000)\r\n\r\n    // Check membership\r\n    if bm.Contains(42) {\r\n        // Do something\r\n    }\r\n\r\n    // Remove a value\r\n    bm.Remove(1)\r\n\r\n    // Count values\r\n    fmt.Println(\"Count:\", bm.Count())\r\n\r\n    // Iterate values\r\n    bm.Range(func(x uint32) {\r\n        fmt.Println(x)\r\n    })\r\n\r\n    // Set operations\r\n    bm2 := roaring.New()\r\n    bm2.Set(42)\r\n    bm2.Set(7)\r\n    bm.Or(bm2) // Union\r\n\r\n    // Serialization\r\n    data := bm.ToBytes()\r\n    bm3 := roaring.FromBytes(data)\r\n    fmt.Println(bm3.Contains(42)) // true\r\n}\r\n```\r\n\r\n## API Highlights\r\n\r\n- `Set(x uint32)`: Add a value.\r\n- `Remove(x uint32)`: Remove a value.\r\n- `Contains(x uint32) bool`: Check if a value is present.\r\n- `Count() int`: Number of values in the bitmap.\r\n- `Range(func(x uint32))`: Iterate all values.\r\n- `And`, `Or`, `Xor`, `AndNot`: Set operations.\r\n- `ToBytes`, `FromBytes`, `WriteTo`, `ReadFrom`: Serialization.\r\n\r\n\r\n## Benchmarks\r\n\r\n```go\r\nname                 time/op      ops/s        allocs/op    vs ref\r\n-------------------- ------------ ------------ ------------ ------------------\r\nset 1K (seq)         21.6 ns      46.2M        0             🟰 similar\r\nset 1K (rnd)         29.7 ns      33.7M        0             ✅ +12%\r\nset 1K (sps)         17.8 ns      56.1M        0             ✅ +29%\r\nset 1K (dns)         19.0 ns      52.6M        0             ✅ +16%\r\nset 1M (seq)         12.0 ns      83.1M        0             ✅ +20%\r\nset 1M (rnd)         18.6 ns      53.8M        0             🟰 similar\r\nset 1M (sps)         31.8 ns      31.5M        0             ✅ +27%\r\nset 1M (dns)         12.0 ns      83.4M        0             🟰 similar\r\nhas 1K (seq)         17.6 ns      57.0M        0             ✅ +12%\r\nhas 1K (rnd)         21.9 ns      45.7M        0             ✅ +25%\r\nhas 1K (sps)         12.7 ns      78.8M        0             ✅ +57%\r\nhas 1K (dns)         14.8 ns      67.4M        0             ✅ +39%\r\nhas 1M (seq)         9.6 ns       104.7M       0             🟰 similar\r\nhas 1M (rnd)         18.1 ns      55.2M        0             🟰 similar\r\nhas 1M (sps)         27.9 ns      35.8M        0             ✅ +24%\r\nhas 1M (dns)         10.8 ns      92.2M        0             🟰 similar\r\ndel 1K (seq)         6.4 ns       155.2M       0             ❌ -7%\r\ndel 1K (rnd)         6.5 ns       154.8M       0             ❌ -7%\r\ndel 1K (sps)         6.4 ns       155.7M       0             🟰 similar\r\ndel 1K (dns)         6.4 ns       156.5M       0             🟰 similar\r\ndel 1M (seq)         6.5 ns       153.6M       0             🟰 similar\r\ndel 1M (rnd)         19.3 ns      51.9M        0             ✅ +8%\r\ndel 1M (sps)         12.1 ns      82.7M        0             ✅ +89%\r\ndel 1M (dns)         37.8 ns      26.4M        0             ✅ +17%\r\nand 1K (seq)         802.5 ns     1.2M         4             🟰 similar\r\nand 1K (rnd)         600.8 ns     1.7M         4             🟰 similar\r\nand 1K (sps)         1.1 µs       886.6K       19            ✅ +14%\r\nand 1K (dns)         172.9 ns     5.8M         4             ❌ -23%\r\nand 1M (seq)         24.5 µs      40.8K        19            ✅ +24%\r\nand 1M (rnd)         24.5 µs      40.8K        19            ✅ +23%\r\nand 1M (sps)         3.7 ms       272          15.3K         🟰 similar\r\nand 1M (dns)         2.8 µs       361.0K       5             ✅ +2.7x\r\nor 1K (seq)          1.8 µs       544.6K       16            ❌ -14%\r\nor 1K (rnd)          1.6 µs       630.1K       16            ❌ -32%\r\nor 1K (sps)          2.0 µs       503.5K       32            ✅ +14%\r\nor 1K (dns)          354.3 ns     2.8M         12            ✅ +19%\r\nor 1M (seq)          25.6 µs      39.1K        27            ✅ +14%\r\nor 1M (rnd)          25.4 µs      39.3K        27            ✅ +18%\r\nor 1M (sps)          4.0 ms       250          15.3K         🟰 similar\r\nor 1M (dns)          2.8 µs       351.9K       8             ✅ +248x\r\nxor 1K (seq)         1.2 µs       811.6K       14            🟰 similar\r\nxor 1K (rnd)         1.1 µs       917.8K       14            ❌ -17%\r\nxor 1K (sps)         1.8 µs       556.7K       32            ✅ +19%\r\nxor 1K (dns)         210.2 ns     4.8M         7             ✅ +15x\r\nxor 1M (seq)         25.4 µs      39.4K        27            ✅ +93%\r\nxor 1M (rnd)         25.3 µs      39.5K        27            ✅ +97%\r\nxor 1M (sps)         3.9 ms       257          15.3K         ✅ +9%\r\nxor 1M (dns)         2.9 µs       345.8K       8             ✅ +7.1x\r\nandnot 1K (seq)      976.8 ns     1.0M         4             ❌ -7%\r\nandnot 1K (rnd)      685.7 ns     1.5M         4             ❌ -7%\r\nandnot 1K (sps)      1.4 µs       727.7K       19            🟰 similar\r\nandnot 1K (dns)      165.1 ns     6.1M         4             ✅ +30x\r\nandnot 1M (seq)      24.3 µs      41.1K        19            ✅ +30%\r\nandnot 1M (rnd)      24.4 µs      41.0K        19            ✅ +44%\r\nandnot 1M (sps)      3.7 ms       269          15.3K         🟰 similar\r\nandnot 1M (dns)      2.8 µs       362.7K       5             ✅ +9.6x\r\nrange 1K (seq)       485.7 ns     2.1M         0             🟰 similar\r\nrange 1K (rnd)       383.6 ns     2.6M         0             🟰 similar\r\nrange 1K (sps)       542.2 ns     1.8M         0             ✅ +25%\r\nrange 1K (dns)       106.6 ns     9.4M         0             🟰 similar\r\nrange 1M (seq)       2.3 ms       441          0             ❌ -35%\r\nrange 1M (rnd)       2.1 ms       482          0             ❌ -43%\r\nrange 1M (sps)       558.6 µs     1.8K         0             ✅ +12%\r\nrange 1M (dns)       203.9 µs     4.9K         0             ✅ +45%\r\n```\r\n\r\n\r\n## About\r\n\r\nBench is MIT licensed and maintained by [@kelindar](https:/r). PRs and issues welcome! ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkelindar%2Froaring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkelindar%2Froaring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkelindar%2Froaring/lists"}