{"id":22993893,"url":"https://github.com/erizocosmico/go-ewah","last_synced_at":"2025-10-30T20:23:23.408Z","repository":{"id":57519272,"uuid":"127784701","full_name":"erizocosmico/go-ewah","owner":"erizocosmico","description":"EWAH bitmap compression library for Go.","archived":false,"fork":false,"pushed_at":"2021-09-18T14:14:47.000Z","size":14,"stargazers_count":15,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-06-20T16:48:32.054Z","etag":null,"topics":["bitmap","compression","ewah","go"],"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/erizocosmico.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":"2018-04-02T16:49:07.000Z","updated_at":"2023-03-27T18:50:12.000Z","dependencies_parsed_at":"2022-09-06T05:10:51.323Z","dependency_job_id":null,"html_url":"https://github.com/erizocosmico/go-ewah","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erizocosmico%2Fgo-ewah","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erizocosmico%2Fgo-ewah/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erizocosmico%2Fgo-ewah/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erizocosmico%2Fgo-ewah/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erizocosmico","download_url":"https://codeload.github.com/erizocosmico/go-ewah/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229783325,"owners_count":18123454,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","compression","ewah","go"],"created_at":"2024-12-15T05:15:30.530Z","updated_at":"2025-10-30T20:23:23.284Z","avatar_url":"https://github.com/erizocosmico.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-ewah [![GoDoc](https://godoc.org/github.com/erizocosmico/go-ewah?status.svg)](https://godoc.org/github.com/erizocosmico/go-ewah) [![Test](https://github.com/erizocosmico/go-ewah/actions/workflows/test.yml/badge.svg)](https://github.com/erizocosmico/go-ewah/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/erizocosmico/go-ewah/branch/master/graph/badge.svg)](https://codecov.io/gh/erizocosmico/go-ewah) [![Go Report Card](https://goreportcard.com/badge/github.com/erizocosmico/go-ewah)](https://goreportcard.com/report/github.com/erizocosmico/go-ewah) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n`go-ewah` is a pure Go implementation of the EWAH bitmap compression format with no dependencies other than the assertion library for the tests.\n\n## Goals\n\n- Read and write EWAH bitmaps using the [serialization format used by git](https://github.com/git/git/blob/master/Documentation/technical/bitmap-format.txt#L92).\n- Fast read and writes.\n\n## Install\n\n```\ngo get github.com/erizocosmico/go-ewah\n```\n\n## Usage\n\n### Read from bytes\n\n```go\nbitmap, err := bitmap.FromBytes(somebytes, binary.BigEndian)\nif err != nil {\n    // check error\n}\n\nvalue, err := bitmap.Get(6)\nif err != nil {\n    // check error\n}\n\nfmt.Println(value) // either `true` or `false`\n```\n\n### Read from a reader\n\n```go\nbitmap, err := bitmap.FromReader(somereader, binary.BigEndian)\nif err != nil {\n    // check error\n}\n \n// the rest is the same as the previous example\n```\n\n### Create bitmap manually\n\nBy default all bits are 0, so we only call `Set(bitPos)` to mark the ones. Once a bit N has been set, you can't set a bit M whose index is lower than the index of N.\n\n```go\nb := bitmap.New()\n\nif err := b.Set(6); err != nil {\n    // handle error\n}\n```\n\n### Write bitmap\n\n```go\nb := bitmap.New()\n\n// fill the bitmap\n\nw := bytes.NewBuffer(nil)\nbytesWritten, err := b.Write(w, binary.BigEndian)\nif err != nil {\n    // handle error\n}\n```\n\n## Data format\n\nFor more details regarding the compression format, please see Section 3 of the following paper:\n\nDaniel Lemire, Owen Kaser, Kamel Aouiche, Sorting improves word-aligned bitmap indexes. Data \u0026 Knowledge Engineering 69 (1), pages 3-28, 2010.\nhttp://arxiv.org/abs/0901.3751\n\nOr check the [Java reference implementation](https://github.com/lemire/javaewah).\n\n## Benchmarks\n\n```\n$ go test . -bench=. -benchmem\ngoos: darwin\ngoarch: amd64\npkg: github.com/erizocosmico/go-ewah\nBenchmarkBitmapGet-4            100000000               17.5 ns/op             0 B/op          0 allocs/op\nBenchmarkBitmapWrite-4           5000000               338 ns/op              64 B/op          9 allocs/op\nBenchmarkBitmapRead-4            3000000               537 ns/op             272 B/op         12 allocs/op\nBenchmarkBitmapSet-4            200000000                8.14 ns/op            0 B/op          0 allocs/op\nPASS\nok      github.com/erizocosmico/go-ewah 44.797s\n```\n\nBenchmarks run on a MacBook Pro Retina (mid-2014) with a 2,6 GHz Intel Core i5 processor running macOS High Sierra 10.13.3.\n\n## License\n\nMIT, see [LICENSE](/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferizocosmico%2Fgo-ewah","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferizocosmico%2Fgo-ewah","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferizocosmico%2Fgo-ewah/lists"}