{"id":17644430,"url":"https://github.com/vigna/sux-rs","last_synced_at":"2026-04-11T19:01:14.290Z","repository":{"id":160310273,"uuid":"635252701","full_name":"vigna/sux-rs","owner":"vigna","description":"Rust implementations of succinct data structures","archived":false,"fork":false,"pushed_at":"2026-04-06T18:31:01.000Z","size":4644,"stargazers_count":69,"open_issues_count":8,"forks_count":9,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-04-06T20:16:57.484Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vigna.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-Apache-2.0","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-05-02T09:49:39.000Z","updated_at":"2026-04-06T05:36:57.000Z","dependencies_parsed_at":"2026-03-15T09:05:43.133Z","dependency_job_id":null,"html_url":"https://github.com/vigna/sux-rs","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/vigna/sux-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vigna%2Fsux-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vigna%2Fsux-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vigna%2Fsux-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vigna%2Fsux-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vigna","download_url":"https://codeload.github.com/vigna/sux-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vigna%2Fsux-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31691503,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T13:07:20.380Z","status":"ssl_error","status_checked_at":"2026-04-11T13:06:47.903Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":[],"created_at":"2024-10-23T10:05:25.137Z","updated_at":"2026-04-11T19:01:14.284Z","avatar_url":"https://github.com/vigna.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `sux`\n\n[![crates.io](https://img.shields.io/crates/v/sux.svg)](https://crates.io/crates/sux)\n[![docs.rs](https://docs.rs/sux/badge.svg)](https://docs.rs/sux)\n[![rustc](https://img.shields.io/badge/rustc-1.85+-red.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html)\n[![CI](https://github.com/vigna/sux-rs/actions/workflows/rust.yml/badge.svg)](https://github.com/vigna/sux-rs/actions)\n![license](https://img.shields.io/crates/l/sux)\n[![downloads](https://img.shields.io/crates/d/sux)](https://crates.io/crates/sux)\n[![coveralls](https://coveralls.io/repos/github/vigna/sux-rs/badge.svg?branch=main)](https://coveralls.io/github/vigna/sux-rs?branch=main)\n\nA pure Rust implementation of succinct and compressed data structures.\n\nThis crate started as part of the [Sux] project; it contains also code ported\nfrom [the DSI Utilities] and new structures.\n\n## Highlights\n\n- Support for 32-bit and 64-bit architectures;\n- [bit vectors and bit-field vectors];\n- several structures for [rank and selection] with different tradeoffs;\n- [indexed dictionaries], including an implementation of the popular [Elias–Fano\n  representation of monotone sequences], and [lists of strings compressed by\n  prefix omission].\n- new state-of-the-art structures for [static functions] and [static filters],\n  scaling to trillions of keys, and providing very fast queries;\n- [monotone minimal perfect hash functions] based on longest common prefixes;\n- support for [signed minimal perfect hash functions];\n- [partial arrays], that is, “arrays with holes”, implemented using ranking or\n  Elias–Fano;\n- [lists] (e.g., [compressed lists of integers]);\n- basic structures for [balanced parantheses].\n\nThe focus is on performance (e.g., there are unchecked versions of all methods\nand support for [unaligned access]) and on flexible composability (e.g., you can\nfine-tune your [`EliasFano`] instance by choosing different types of internal\nindices, and whether to index zeros or ones). Whenever possible, there are\nmapping methods that replace an underlying structure with another one, provided\nit is compatible.\n\nThis crate does not provide high-level genericity on bit vectors: [operations on\nbit vectors] are based on a word type `W`, on the [`BitLength`] trait, which\nprovides the bit length, and on the traits [`AsRef\u003cW\u003e`]/[`AsMut\u003cW\u003e`], which\nprovide concrete access to the underlying data. This approach makes it possible\nto use any structure that implements these traits as a bit vector, and to\nimplement your own bit vector if you need specific features (e.g., support for\nunaligned access). Additionally, we support [`Index\u003cusize, Output = bool\u003e`] for\nbit vectors, so you can read them as you would read a slice of `bool`.\n\nRank/select structures are built on backends implementing the [`Backend`] trait,\nproviding via an associated type the word type, and on the traits above;\nmoreover, the strutures export the same traits by delegation, so you can use any\nstructure as a backend for (further) rank/select structures, making arbitrary\nnesting of structures simple, typesafe and zero-cost. The same is true of\nstructures for balanced parentheses. All structures [`Deref`] to their backends,\ntoo.\n\n## Slice-by-value support\n\nWherever possible, we support the “slice by value” traits from the\n[`value-traits`] crate, which make it possible to treat structures such as\nbit-field vectors or succinct representations in a manner similar to slices.\nThis approach is also used to make [vectors of bit fields] and slices (where the\nbit width of the fields is exactly that of the word type) interchangeable.\n\n## Support for unaligned access\n\nThe [`TryIntoUnaligned`] trait provides a [`try_into_unaligned`] method that can\nbe used to convert recursively all components of a structure into components\nusing unaligned access to retrieve bit sequences. This approach makes unaligned\naccess typesafe.\n\n## ε-serde support\n\nAll structures in this crate are designed to work well with [ε-serde]: in\nparticular, once you have created and serialized them, you can easily map them\ninto memory or load them in memory regions with specific `mmap()` attributes.\nSupport for ε-serde is provided by the feature `epserde`, and support for\nmemory mapping in ε-serde is provided by the `mmap` feature.\n\n## serde support\n\nAll structures in this crate support serialization with [serde]. Support is\ngated by the feature `serde`.\n\n## `MemDbg`/`MemSize` support\n\nAll structures in this crate support the [`MemDbg`] and [`MemSize`] traits from\nthe [`mem_dbg`] crate, which provide convenient facilities for inspecting memory\nusage and debugging memory-related issues. For example, this is the output of\n`mem_dbg()` on an [`EliasFano`] instance:\n\n```text\n11.15 MB 100.00% ⏺: sux::dict::elias_fano::EliasFano\u003csux::rank_sel::select_zero_adapt_const::SelectZeroAdaptConst\u003csux::rank_sel::select_adapt_const::SelectAdaptConst\u003csux::bits::bit_vec::BitVec\u003calloc::boxed::Box\u003c[usize]\u003e\u003e\u003e\u003e\u003e\n7.500 MB  67.24% ├╴low_bits: sux::bits::bit_field_vec::BitFieldVec\u003cusize, alloc::boxed::Box\u003c[usize]\u003e\u003e\n7.500 MB  67.24% │ ├╴bits: alloc::boxed::Box\u003c[usize]\u003e\n    8  B   0.00% │ ├╴bit_width: usize\n    8  B   0.00% │ ├╴mask: usize\n    8  B   0.00% │ ╰╴len: usize\n3.654 MB  32.76% ├╴high_bits: sux::rank_sel::select_zero_adapt_const::SelectZeroAdaptConst\u003csux::rank_sel::select_adapt_const::SelectAdaptConst\u003csux::bits::bit_vec::BitVec\u003calloc::boxed::Box\u003c[usize]\u003e\u003e\u003e\u003e\n3.379 MB  30.29% │ ├╴bits: sux::rank_sel::select_adapt_const::SelectAdaptConst\u003csux::bits::bit_vec::BitVec\u003calloc::boxed::Box\u003c[usize]\u003e\u003e\u003e\n3.203 MB  28.72% │ │ ├╴bits: sux::bits::bit_vec::BitVec\u003calloc::boxed::Box\u003c[usize]\u003e\u003e\n3.203 MB  28.72% │ │ │ ├╴bits: alloc::boxed::Box\u003c[usize]\u003e\n    8  B   0.00% │ │ │ ╰╴len: usize\n175.8 kB   1.58% │ │ ├╴inventory: alloc::boxed::Box\u003c[usize]\u003e\n   16  B   0.00% │ │ ╰╴spill: alloc::boxed::Box\u003c[usize]\u003e\n274.7 kB   2.46% │ ├╴inventory: alloc::boxed::Box\u003c[usize]\u003e\n   16  B   0.00% │ ╰╴spill: alloc::boxed::Box\u003c[usize]\u003e\n    8  B   0.00% ├╴n: usize\n    8  B   0.00% ├╴u: usize\n    8  B   0.00% ╰╴l: usize\n```\n\n## Binaries\n\nA few binaries make it possible to build and serialize structures with ε-serde\n(e.g., `rcl`, `vfunc`, and `vfilter`). Moreover, there are examples benchmarking\nthe structures (e.g., `bench_rear_coded_list`, `bench_vfunc`, and\n`bench_vfilter`). You have to use the feature `cli` to build them.\n\n## Features\n\nThe crate has the following features:\n\n- `rayon`: enables support for parallel iterators using the `rayon` crate\n  (default);\n- `flate2`: enables support for gzip-compressed files in the [`lenders`] module\n  (default);\n- `zstd`: enables support for zstd-compressed files in the [`lenders`] module\n  (default);\n- `deko`: enables support for the [`deko`] crate, which provides dynamic\n  detection of compressed files for the [`lenders`] module;\n- `epserde`: enables support for [ε-serde];\n- `serde`: enables support for [serde];\n- `clap`: enables the `clap` crate for command-line argument parsing;\n- `cli`: builds the binaries (implies `clap`, `epserde`, `deko`);\n- `mmap`: enables support for memory mapping in ε-serde (implies `epserde`);\n- `aarch64_prefetch`: enables prefetch support on aarch64 (requires nightly).\n\nNote: The [`MemDbg`] and [`MemSize`] traits from the [`mem_dbg`] crate are\nalways available as `mem_dbg` is a required dependency.\n\n## Benchmarks\n\nA few benchmarks are available in the `benches` directory. The ones starting with\n`bench_` can be just run as usual; for example,\n\n```bash\ncargo bench --bench bench_vfunc\n```\n\nThe `sux` benchmark, which tests rank and select structures, is instead a CLI\ncommand with options. Try\n\n```bash\ncargo bench --bench sux -- --help\n```\n\nto see the available tests. For example, with\n\n```bash\ncargo bench --bench sux -- Rank9 -d 0.5 -l 100000,1000000,10000000\n```\n\nyou can test the [`Rank9`] structure with a density of 0.5 on a few bit sizes.\nAfterwards, you can generate an SVG plot and CSV\ndata in the `plots` directory with\n\n```bash\n./python/plot_benches.py --benches-path ./target/criterion/ --plot-dir plots\n```\n\nYou can then open the `plots/plot.svg` with a browser to see the results, or\ninspect the directory `csv` for CSV data. Note that as you run benchmarks, the\nresults will cumulate in the `target/criterion` directory, so you can generate\nplots for multiple runs.\n\nBy specifying multiple structures (using also substring matching), you can\ncompare the behavior of different structures. For example,\n\n```bash\ncargo bench --bench sux -- SelectSmall SelectAdapt0 -d 0.5 -l 100000,1000000,10000000\n```\n\nwill test all variants of [`SelectSmall`] against a [`SelectAdapt`] with one (2⁰)\n`u64` per subinventory. The plot will highlight the differences in performance:\n\n```bash\n./python/plot_benches.py --benches-path ./target/criterion/ --plot-dir plots\n```\n\n## Acknowledgments\n\nThis software has been partially supported by project SERICS (PE00000014) under\nthe NRRP MUR program funded by the EU - NGEU, and by project ANR COREGRAPHIE,\ngrant ANR-20-CE23-0002 of the French Agence Nationale de la Recherche. Views and\nopinions expressed are however those of the authors only and do not necessarily\nreflect those of the European Union or the Italian MUR. Neither the European\nUnion nor the Italian MUR can be held responsible for them.\n\n[bit vectors and bit-field vectors]: https://docs.rs/sux/latest/sux/bits/index.html\n[rank and selection]: https://docs.rs/sux/latest/sux/rank_sel/index.html\n[indexed dictionaries]: https://docs.rs/sux/latest/sux/traits/indexed_dict/index.html\n[`EliasFano`]: https://docs.rs/sux/latest/sux/dict/elias_fano/struct.EliasFano.html\n[ε-serde]: https://crates.io/crates/epserde\n[`MemDbg`]: https://docs.rs/mem_dbg/latest/mem_dbg/trait.MemDbg.html\n[`MemSize`]: https://docs.rs/mem_dbg/latest/mem_dbg/trait.MemSize.html\n[`mem_dbg`]: https://crates.io/crates/mem_dbg\n[Elias–Fano representation of monotone sequences]: https://docs.rs/sux/latest/sux/dict/elias_fano/struct.EliasFano.html\n[lists of strings compressed by prefix omission]: https://docs.rs/sux/latest/sux/dict/rear_coded_list/\n[Sux]: https://sux.di.unimi.it/\n[the DSI Utilities]: https://dsiutils.di.unimi.it/\n[`BitLength`]: https://docs.rs/sux/latest/sux/traits/rank_sel/trait.BitLength.html\n[`Rank9`]: https://docs.rs/sux/latest/sux/rank_sel/struct.Rank9.html\n[`SelectSmall`]: https://docs.rs/sux/latest/sux/rank_sel/struct.SelectSmall.html\n[`SelectAdapt`]: https://docs.rs/sux/latest/sux/rank_sel/struct.SelectAdapt.html\n[static functions]: https://docs.rs/sux/latest/sux/func/vfunc/struct.VFunc.html\n[monotone minimal perfect hash functions]: https://docs.rs/sux/latest/sux/func/lcp_mmphf/index.html\n[static filters]: https://docs.rs/sux/latest/sux/dict/vfilter/struct.VFilter.html\n[partial arrays]: https://docs.rs/sux/latest/sux/array/struct.PartialArray.html\n[opertions on bit vectors]: https://docs.rs/sux/latest/sux/traits/bit_vec_ops/index.html\n[unaligned access]: https://docs.rs/sux/latest/sux/traits/trait.TryIntoUnaligned.html\n[`value-traits`]: https://crates.io/crates/value-traits\n[serde]: https://crates.io/crates/serde/\n[`deko`]: https://crates.io/crates/deko/\n[`lenders`]: https://docs.rs/sux/latest/sux/utils/lenders/\n[signed minimal perfect hash functions]: https://docs.rs/sux/latest/sux/func/signed/struct.SignedVFunc.html\n[lists]: https://docs.rs/sux/latest/sux/list/index.html\n[compressed lists of integers]: https://docs.rs/sux/latest/sux/list/comp_int_list/struct.CompIntList.html\n[`AsRef\u003cBackend:Word\u003e`]: https://doc.rust-lang.org/core/convert/trait.AsRef.html\n[`AsMut\u003cBackend:Word\u003e`]: https://doc.rust-lang.org/core/convert/trait.AsMut.html\n[`AsRef\u003cW\u003e`]: https://doc.rust-lang.org/core/convert/trait.AsRef.html\n[`AsMut\u003cW\u003e`]: https://doc.rust-lang.org/core/convert/trait.AsMut.html\n[`Word`]: https://docs.rs/sux/latest/sux/traits/trait.Backend.html#associatedtype.Word\n[`Backend`]: https://docs.rs/sux/latest/sux/traits/trait.Backend.html\n[balanced parantheses]: https://docs.rs/sux/latest/sux/bal_paren/index.html\n[`Index\u003cusize, Output = bool\u003e`]: https://doc.rust-lang.org/core/ops/index/trait.Index.html\n[operations on bit vectors]: https://docs.rs/sux/latest/sux/traits/bit_vec_ops/index.html\n[`TryIntoUnaligned`]: https://docs.rs/sux/latest/sux/traits/trait.TryIntoUnaligned.html\n[`try_into_unaligned`]: https://docs.rs/sux/latest/sux/traits/trait.TryIntoUnaligned.html#tymethod.try_into_unaligned\n[`Deref`]: https://doc.rust-lang.org/core/ops/deref/trait.Deref.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvigna%2Fsux-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvigna%2Fsux-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvigna%2Fsux-rs/lists"}