{"id":22683244,"url":"https://github.com/mtchavez/go-hll","last_synced_at":"2025-04-12T18:26:27.644Z","repository":{"id":41416672,"uuid":"9736721","full_name":"mtchavez/go-hll","owner":"mtchavez","description":"Go implementation of Hyper Log Log","archived":false,"fork":false,"pushed_at":"2022-07-01T22:00:43.000Z","size":40,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T12:46:53.241Z","etag":null,"topics":["go","golang","hyperloglog","sketching-algorithm"],"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/mtchavez.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2013-04-28T21:38:16.000Z","updated_at":"2022-07-01T16:40:49.000Z","dependencies_parsed_at":"2022-08-25T08:11:14.796Z","dependency_job_id":null,"html_url":"https://github.com/mtchavez/go-hll","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fgo-hll","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fgo-hll/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fgo-hll/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtchavez%2Fgo-hll/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtchavez","download_url":"https://codeload.github.com/mtchavez/go-hll/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248611968,"owners_count":21133216,"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":["go","golang","hyperloglog","sketching-algorithm"],"created_at":"2024-12-09T21:11:22.704Z","updated_at":"2025-04-12T18:26:27.622Z","avatar_url":"https://github.com/mtchavez.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-hll\n\n[![Latest Version](http://img.shields.io/github/release/mtchavez/go-hll.svg?style=flat-square)](https://github.com/mtchavez/go-hll/releases)\n[![Test](https://github.com/mtchavez/go-hll/actions/workflows/test.yml/badge.svg)](https://github.com/mtchavez/go-hll/actions/workflows/test.yml)\n[![Go Documentation](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/mtchavez/go-hll)\n[![Go Report Card](https://goreportcard.com/badge/github.com/mtchavez/go-hll)](https://goreportcard.com/report/github.com/mtchavez/go-hll)\n[![Maintainability](https://api.codeclimate.com/v1/badges/cbdf4f5b5cfa83ad2030/maintainability)](https://codeclimate.com/github/mtchavez/go-hll/maintainability)\n[![Test Coverage](https://codecov.io/gh/mtchavez/go-hll/branch/master/graph/badge.svg?token=YBShFgosRF)](https://codecov.io/gh/mtchavez/go-hll)\n\nGo implementation of Hyper Log Log\n\n## Install\n\n```go\ngo get github.com/mtchavez/go-hll/hll\n```\n\n## Usage\n\n- [New](#create-new)\n- [New With Default Error](#new-with-default-error)\n- [Adding](#adding)\n- [Count](#count)\n\n### Create new\n\nNew hyper log log table with a desired error\n\n```go\npackage main\n\nimport (\n  \"github.com/mtchavez/go-hll/hll\"\n)\n\nfunc main() {\n  hll := NewWithErr(0.065)\n}\n```\n\n### New with default error\n\n```go\npackage main\n\nimport (\n  \"github.com/mtchavez/go-hll/hll\"\n)\n\nfunc main() {\n  // Uses DefaultErr of 0.065\n  hll := New()\n  hll.Add(\"foo\")\n}\n```\n\n### Adding\n\nAdd some words to the table\n\n```go\npackage main\n\nimport (\n  \"github.com/mtchavez/go-hll/hll\"\n)\n\nfunc main() {\n  hll := NewWithErr(0.065)\n  words := []string{\"apple\", \"this is bananas\", \"kiwi kiwi kiwi\", \"Peach is a peach\", \"apple banana peach wiki pear\"}\n  for _, word := range words {\n    hll.Add(word)\n  }\n}\n```\n\n### Count\n\nGet the count and calculate the error of your hyper log log\n\n```go\nhll := NewWithErr(0.065)\n  words := []string{\"apple\", \"this is bananas\", \"kiwi kiwi kiwi\", \"Peach is a peach\", \"apple banana peach wiki pear\"}\n  for _, word := range words {\n    hll.Add(word)\n  }\n  count := hll.Count()\n  err := float32((count - uint32(len(words))) / uint32(len(words)) / 100.0)\n  fmt.Printf(\"\\nCount: %d\\nError: %f%%\\n\\n\", count, err)\n\n```\n\n## Documentation\n\nDocs can be generated locally using ```godoc``` or go to [godoc.org](http://godoc.org/github.com/mtchavez/go-hll/hll)\n\n## Benchmarks\n\n```txt\n# Updated: 2022-07-01\n\ngoos: darwin\ngoarch: arm64\npkg: github.com/mtchavez/go-hll/hll\n\nBenchmarkHllNew-8         103207             11357 ns/op\nBenchmarkHllAdd-8       15996489             74.95 ns/op\nBenchmarkHllCount-8       156948              7598 ns/op\n```\n\n## Tests\n\nRun tests using ```go test```.\n\n## License\n\nWritten by Chavez\n\nReleased under the MIT License: \u003chttp://www.opensource.org/licenses/mit-license.php\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtchavez%2Fgo-hll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtchavez%2Fgo-hll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtchavez%2Fgo-hll/lists"}