{"id":17398443,"url":"https://github.com/vweevers/hyperloglog32","last_synced_at":"2025-04-30T05:22:32.357Z","repository":{"id":32057754,"uuid":"35629501","full_name":"vweevers/hyperloglog32","owner":"vweevers","description":"HyperLogLog using a 32-bit murmurhash3 for node and the browser","archived":false,"fork":false,"pushed_at":"2015-05-14T22:02:03.000Z","size":104,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-25T01:58:21.025Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/vweevers.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":"2015-05-14T18:39:59.000Z","updated_at":"2019-02-04T23:56:06.000Z","dependencies_parsed_at":"2022-08-25T03:40:51.913Z","dependency_job_id":null,"html_url":"https://github.com/vweevers/hyperloglog32","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/vweevers%2Fhyperloglog32","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fhyperloglog32/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fhyperloglog32/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fhyperloglog32/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vweevers","download_url":"https://codeload.github.com/vweevers/hyperloglog32/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251645989,"owners_count":21620848,"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":[],"created_at":"2024-10-16T14:56:32.919Z","updated_at":"2025-04-30T05:22:32.338Z","avatar_url":"https://github.com/vweevers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hyperloglog32\r\n\r\n\u003e HyperLogLog distinct value estimator for node and the browser using a 32-bit murmurhash3. Fork of [hyperloglog](https://www.npmjs.com/package/hyperloglog) (MIT © Optimizely, Inc). From [Wikipedia](https://en.wikipedia.org/wiki/HyperLogLog): HyperLogLog is an algorithm for the count-distinct problem, approximating the number of distinct elements in a multiset (the cardinality).\r\n\r\n[![npm status](http://img.shields.io/npm/v/hyperloglog32.svg?style=flat-square)](https://www.npmjs.org/package/hyperloglog32) [![Travis build status](https://img.shields.io/travis/vweevers/hyperloglog32.svg?style=flat-square\u0026label=travis)](http://travis-ci.org/vweevers/hyperloglog32) [![AppVeyor build status](https://img.shields.io/appveyor/ci/vweevers/hyperloglog32.svg?style=flat-square\u0026label=appveyor)](https://ci.appveyor.com/project/vweevers/hyperloglog32) [![Dependency status](https://img.shields.io/david/vweevers/hyperloglog32.svg?style=flat-square)](https://david-dm.org/vweevers/hyperloglog32)\r\n\r\nJump to: [api](#api) / [install](#install) / [license](#license)\r\n\r\n## example\r\n\r\nInsert two distinct values into an HLL structure with 12 bit indices. Hashing is done for you:\r\n\r\n```js\r\nvar HyperLogLog = require('hyperloglog32')\r\nvar h = HyperLogLog(12)\r\n\r\nh.add('value 1')\r\nh.add('value 2')\r\nh.add('value 1')\r\n\r\nh.count() === 2;\r\n```\r\n\r\n## api\r\n\r\n### `h = HyperLogLog(n)`\r\n\r\nConstruct an HLL data structure with `n` bit indices. This implies that there will be `2^n` buckets (and required octets). Typical values for `n` are around 12, which would use 4096 buckets and yield less than 1.625% relative error. Higher values use more memory but provide greater precision. [Here](https://www.npmjs.com/package/hll)'s a nice table.\r\n\r\n### `h.add(string)`\r\n\r\nAdd a value.\r\n\r\n### `h.count()`\r\n\r\nGet the current estimate of the number of distinct values.\r\n\r\n### `h.state()`\r\n\r\nGet the internal HLL state as a `Buffer`.\r\n\r\n### `h.merge(h2 || Buffer)`\r\n\r\nMerge another HLL's state into this HLL. If the incoming data has fewer buckets than this HLL, this one will be folded down to be the same size as the incoming data, with a corresponding loss of precision. If the incoming data has more buckets, it will be folded down as it is merged. The result is that this HLL will be updated as though it had processed all values that were previously processed by either HLL.\r\n\r\n```js\r\nh1.add('value 1')\r\nh1.add('value 2')\r\nh2.add('value 2')\r\nh2.add('value 3')\r\n\r\nh1.merge(h2)\r\nh1.count() === 3;\r\n```\r\n\r\n### `h.error()`\r\n\r\nEstimate the relative error for this HLL.\r\n\r\n## install\r\n\r\nWith [npm](https://npmjs.org) do:\r\n\r\n```\r\nnpm i hyperloglog32\r\n```\r\n\r\nand [browserify](http://browserify.org/) for the browser.\r\n\r\n## license\r\n\r\n[MIT](http://opensource.org/licenses/MIT) © [Vincent Weevers](http://vincentweevers.nl)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fhyperloglog32","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvweevers%2Fhyperloglog32","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fhyperloglog32/lists"}