https://github.com/axiomhq/zig-hyperloglog Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code + Explore + All features + Documentation + GitHub Skills + Blog * Solutions + For + Enterprise + Teams + Startups + Education + By Solution + CI/CD & Automation + DevOps + DevSecOps + Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles + Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} axiomhq / zig-hyperloglog Public * Notifications * Fork 1 * Star 50 Zig library for HyperLogLog estimation License MIT license 50 stars 1 fork Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights axiomhq/zig-hyperloglog This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 1 branch 0 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/a] Use Git or checkout with SVN using the web URL. [gh repo clone axiomh] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @seiflotfy seiflotfy update license ... bcbcae8 Jan 9, 2023 update license bcbcae8 Git stats * 22 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time src add HyperLogLogDefault Jan 9, 2023 .gitignore allow different size hll Jan 9, 2023 LICENSE update license Jan 9, 2023 README.md add example to demo Jan 9, 2023 build.zig initial loglogbeta implementation of hyperloglog Jan 6, 2023 View code Zig library for HyperLogLog cardinality estimation LogLog-Beta Example README.md Zig library for HyperLogLog cardinality estimation LogLog-Beta and More: A New Algorithm for Cardinality Estimation Based on LogLog Counting - by Jason Qin, Denys Kim, Yumei Tung TL;DR: Better than HyperLogLog in approximating the number unique elements in a set LogLog-Beta LogLog-Beta is a new algorithm for estimating cardinalities based on LogLog counting. The new algorithm uses only one formula and needs no additional bias corrections for the entire range of cardinalities, therefore, it is more efficient and simpler to implement. The simulations show that the accuracy provided by the new algorithm is as good as or better than the accuracy provided by either of HyperLogLog or HyperLogLog++. Example const std = @import("std"); const HyperLogLog = @import("zig-hyperloglog").DefaultHyperLogLog; const RndGen = std.rand.DefaultPrng; var rnd = RndGen.init(0); pub fn main() !void { const count = 1e7; const alloc = std.heap.page_allocator; var hll = try HyperLogLog().init(alloc); defer hll.deinit(); var i: u64 = 0; while (i < count) : (i += 1) { const x = rnd.random().int(u64); try hll.add_hashed(x); } const est = hll.cardinality(); std.debug.print("Estimated cardinality: {d}\n", .{est}); } About Zig library for HyperLogLog estimation Resources Readme License MIT license Stars 50 stars Watchers 2 watching Forks 1 fork Releases No releases published Packages 0 No packages published Languages * Zig 100.0% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.