{"id":13484785,"url":"https://github.com/sile/patricia_tree","last_synced_at":"2025-10-19T22:57:41.233Z","repository":{"id":45609392,"uuid":"104314463","full_name":"sile/patricia_tree","owner":"sile","description":"A memory-efficient patricia tree implementation written in Rust","archived":false,"fork":false,"pushed_at":"2025-01-13T12:05:12.000Z","size":190,"stargazers_count":120,"open_issues_count":1,"forks_count":18,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-14T19:58:56.579Z","etag":null,"topics":["patricia-tree","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/sile.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-21T07:15:28.000Z","updated_at":"2025-03-17T11:06:28.000Z","dependencies_parsed_at":"2023-12-01T00:26:12.573Z","dependency_job_id":"85d234fc-b65c-42dc-92ee-1b5dab151e6b","html_url":"https://github.com/sile/patricia_tree","commit_stats":{"total_commits":126,"total_committers":7,"mean_commits":18.0,"dds":0.1428571428571429,"last_synced_commit":"ec160f3c2d711732ae56e9d9e883cecb5155fbbb"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Fpatricia_tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Fpatricia_tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Fpatricia_tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Fpatricia_tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sile","download_url":"https://codeload.github.com/sile/patricia_tree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254328384,"owners_count":22052632,"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":["patricia-tree","rust"],"created_at":"2024-07-31T17:01:33.570Z","updated_at":"2025-10-19T22:57:36.211Z","avatar_url":"https://github.com/sile.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"patricia_tree\n=============\n\n[![patricia_tree](https://img.shields.io/crates/v/patricia_tree.svg)](https://crates.io/crates/patricia_tree)\n[![Documentation](https://docs.rs/patricia_tree/badge.svg)](https://docs.rs/patricia_tree)\n[![Actions Status](https://github.com/sile/patricia_tree/workflows/CI/badge.svg)](https://github.com/sile/patricia_tree/actions)\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nMemory-efficient data structures based on patricia tree (a.k.a, radix tree).\n\n[Documentation](https://docs.rs/patricia_tree)\n\nA common prefixes of the keys in a patricia tree are represented by a shared path.\nSo if the prefixes of the key set is highly redundant,\nthe memory usage of the resulting patricia tree will be drastically less than\nmore generic data structures (e.g., `BTreeMap`).\n\nSee [Radix tree](https://en.wikipedia.org/wiki/Radix_tree) for more details.\n\nExamples\n---------\n\n```rust\nuse patricia_tree::PatriciaMap;\n\nlet mut map = PatriciaMap::new();\nmap.insert(\"foo\", 1);\nmap.insert(\"bar\", 2);\nmap.insert(\"baz\", 3);\nassert_eq!(map.len(), 3);\n\nassert_eq!(map.get(\"foo\"), Some(\u00261));\nassert_eq!(map.get(\"bar\"), Some(\u00262));\nassert_eq!(map.get(\"baz\"), Some(\u00263));\n```\n\nBenchmarks\n-----------\n\n```console\n$ cargo run --example insert_lines --release -- --version 2\u003e /dev/null\ninsert_lines 0.1.0\n\n///\n/// INPUT: Wikipedia\n///\n$ curl -s https://dumps.wikimedia.org/enwiki/latest/enwiki-latest-all-titles-in-ns0.gz | gzip -d \u003e enwiki-latest-all-titles-in-ns0\n$ du -hs enwiki-latest-all-titles-in-ns0\n271M    enwiki-latest-all-titles-in-ns0\n\n// HashSet\n$ /usr/bin/time -f \"# ELAPSED: %E\\n# MEMORY: %M\" cargo run --example insert_lines --release -- --kind hash \u003c enwiki-latest-all-titles-in-ns0\n# LINES: 13450823\n# ELAPSED: 0:10.23\n# MEMORY: 1001548  // 978 MB\n\n// BTreeSet\n$ /usr/bin/time -f \"# ELAPSED: %E\\n# MEMORY: %M\" cargo run --example insert_lines --release -- --kind btree \u003c enwiki-latest-all-titles-in-ns0\n# LINES: 13450823\n# ELAPSED: 0:10.90\n# MEMORY: 1112068  // 1,086 MB\n\n// PatriciaSet\n$ /usr/bin/time -f \"# ELAPSED: %E\\n# MEMORY: %M\" cargo run --example insert_lines --release -- --kind patricia \u003c enwiki-latest-all-titles-in-ns0\n# LINES: 13450823\n# ELAPSED: 1:12.55\n# MEMORY: 434340   // 424 MB\n\n///\n/// INPUT: Google 5-gram\n///\n$ curl -s http://storage.googleapis.com/books/ngrams/books/googlebooks-eng-all-5gram-20120701-0.gz | gzip -d \u003e googlebooks-eng-all-5gram-20120701-0\n$ du -hs googlebooks-eng-all-5gram-20120701-0\n331M    googlebooks-eng-all-5gram-20120701-0\n\n// HashSet\n$ /usr/bin/time -f \"# ELAPSED: %E\\n# MEMORY: %M\" cargo run --example insert_lines --release -- --kind hash \u003c googlebooks-eng-all-5gram-20120701-0\n# LINES: 9814743\n# ELAPSED: 0:08.36\n# MEMORY: 1115544  // 1,089 MB\n\n// BTreeSet\n$ /usr/bin/time -f \"# ELAPSED: %E\\n# MEMORY: %M\" cargo run --example insert_lines --release -- --kind btree \u003c googlebooks-eng-all-5gram-20120701-0\n# LINES: 9814743\n# ELAPSED: 0:06.85\n# MEMORY: 942236   // 920 MB\n\n// PatriciaSet\n$ /usr/bin/time -f \"# ELAPSED: %E\\n# MEMORY: %M\" cargo run --example insert_lines --release -- --kind patricia \u003c googlebooks-eng-all-5gram-20120701-0\n# LINES: 9814743\n# ELAPSED: 0:25.62\n# MEMORY: 223616   // 218 MB\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsile%2Fpatricia_tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsile%2Fpatricia_tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsile%2Fpatricia_tree/lists"}