{"id":19814094,"url":"https://github.com/guibrandt/persistentarray","last_synced_at":"2025-02-28T14:04:23.086Z","repository":{"id":129285940,"uuid":"277165521","full_name":"GuiBrandt/PersistentArray","owner":"GuiBrandt","description":"Persistent array data structure in JS","archived":false,"fork":false,"pushed_at":"2023-07-14T22:45:35.000Z","size":586,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-11T07:36:13.374Z","etag":null,"topics":["array","functional-programming","js","persistent-data-structure"],"latest_commit_sha":null,"homepage":"https://guibrandt.github.io/PersistentArray","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GuiBrandt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2020-07-04T18:33:53.000Z","updated_at":"2020-07-05T19:43:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"d8a7a6ed-2ecd-4675-b647-a249188439d9","html_url":"https://github.com/GuiBrandt/PersistentArray","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/GuiBrandt%2FPersistentArray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuiBrandt%2FPersistentArray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuiBrandt%2FPersistentArray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuiBrandt%2FPersistentArray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GuiBrandt","download_url":"https://codeload.github.com/GuiBrandt/PersistentArray/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241162475,"owners_count":19920410,"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":["array","functional-programming","js","persistent-data-structure"],"created_at":"2024-11-12T09:38:04.054Z","updated_at":"2025-02-28T14:04:23.060Z","avatar_url":"https://github.com/GuiBrandt.png","language":"JavaScript","readme":"# Persistent Array\n\n![Build Status][build]\n![Documentation][docs]\n\nA persistent data structure is one that accepts updates while keeping\nimmutability, by preserving original data and only recording updates, usually\nin the form of a directed graph.\n\nThis is an implementation of a persistent array data structure which optimizes\nfor fast updates and minimum space usage, keeping reads efficient when done\nmany at a time by using shallow binding.\n\n[build]: https://github.com/GuiBrandt/PersistentArray/workflows/Build/badge.svg\n[docs]: https://github.com/GuiBrandt/PersistentArray/workflows/Documentation/badge.svg\n\n## Characteristics\n\n- Read `i`: To perform a simple query for an element at a given index.\n  Takes O(u) time, where u = number of updates. However, sequential reads to\n  the same version or to child versions (i.e. O(1) updates apart) take constant\n  time.\n\n- Update `i`, `v`: To update the array by putting value `v` at index `i`\n  without mutating it.\n  Takes O(1) time and allocates O(1) space.\n\n- **NOT thread-safe:** To allow for efficient reads, this implementation uses\n  a context tree which is shared by all versions of the array and needs\n  mutability in order to maintain coherence while maintining space usage to a\n  minimum.\n\nUltimately, the primary advantage of this data structure against an ordinary\nArray is that updates can preserve previous versions while still taking O(1)\ntime and space, when doing the same thing with an Array would take O(n) time\nand space.\n\nA semi-thread-safe implementation that does not require locks might be\npossible, and will be worked on in the future. \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguibrandt%2Fpersistentarray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguibrandt%2Fpersistentarray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguibrandt%2Fpersistentarray/lists"}