{"id":26597358,"url":"https://github.com/ryzhyk/arc-interner","last_synced_at":"2025-03-23T17:36:14.107Z","repository":{"id":45854576,"uuid":"258543223","full_name":"ryzhyk/arc-interner","owner":"ryzhyk","description":"A concurrent interner that deallocates unused values","archived":false,"fork":false,"pushed_at":"2023-12-07T11:09:16.000Z","size":14,"stargazers_count":6,"open_issues_count":5,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T07:47:02.086Z","etag":null,"topics":["interner","rust-crate"],"latest_commit_sha":null,"homepage":null,"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/ryzhyk.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":"2020-04-24T14:58:50.000Z","updated_at":"2024-12-27T06:18:45.000Z","dependencies_parsed_at":"2022-09-02T14:12:12.177Z","dependency_job_id":null,"html_url":"https://github.com/ryzhyk/arc-interner","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryzhyk%2Farc-interner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryzhyk%2Farc-interner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryzhyk%2Farc-interner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryzhyk%2Farc-interner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryzhyk","download_url":"https://codeload.github.com/ryzhyk/arc-interner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245143610,"owners_count":20568042,"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":["interner","rust-crate"],"created_at":"2025-03-23T17:36:13.057Z","updated_at":"2025-03-23T17:36:14.092Z","avatar_url":"https://github.com/ryzhyk.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Rust](https://github.com/ryzhyk/arc-interner/workflows/Rust/badge.svg)\n\n# An interner that deallocates unused values.\n\nThis crate is a fork of [David Roundy's](https://github.com/droundy/)\n[`internment` crate](https://crates.io/crates/internment).\nIt provides an alternative implementation of the `internment::ArcIntern`\ntype.  It inherits David's high-level design and API; however it is built\ncompletely on Rust's standard `Arc` type and the\n[`dashmap` crate](https://crates.io/crates/dashmap) and does not contain\nany unsafe code.\n\nInterning reduces the memory footprint of an application by storing\na unique copy of each distinct value.  It speeds up equality\ncomparison and hashing operations, as only pointers rather than actual\nvalues need to be compared.  On the flip side, object creation is\nslower, as it involves lookup in the interned object pool.\n\nInterning is most commonly applied to strings; however it can also\nbe useful for other object types.  This library supports interning\nof arbitrary objects.\n\nThere exist several interning libraries for Rust, each with its own\nset of tradeoffs.  This library makes the following design\nchoices:\n\n- Interned objects are reference counted.  When the last reference to\n  an interned object is dropped, the object is deallocated.  This\n  prevents unbounded growth of the interned object pool in applications\n  where the set of interned values changes dynamically at the cost of\n  some CPU and memory overhead (due to storing and maintaining an\n  atomic counter).\n- Multithreading.  A single pool of interned objects is shared by all\n  threads in the program.  The pool is implemented as a `DashMap` for\n  safe concurrent access and low contention.\n- Not just strings: this library allows interning any data type that\n  satisfies the `Eq + Hash + Send + Sync` trait bound.\n- Safe: this library is built on `Arc` and `DashMap` types\n  and does not contain any unsafe code.\n\n# Example\n\n```rust\nuse arc_interner::ArcIntern;\nlet x = ArcIntern::new(\"hello\");\nlet y = ArcIntern::new(\"world\");\nassert_ne!(x, y);\nassert_eq!(x, ArcIntern::new(\"hello\"));\nassert_eq!(*x, \"hello\"); // dereference an ArcIntern like a pointer\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryzhyk%2Farc-interner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryzhyk%2Farc-interner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryzhyk%2Farc-interner/lists"}