{"id":22472207,"url":"https://github.com/ckampfe/vector","last_synced_at":"2025-08-02T09:32:34.366Z","repository":{"id":57478997,"uuid":"94034885","full_name":"ckampfe/vector","owner":"ckampfe","description":"an array-backed vector datatype for Elixir","archived":false,"fork":false,"pushed_at":"2017-07-22T22:36:02.000Z","size":22,"stargazers_count":2,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-09T16:52:54.397Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/ckampfe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","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":"2017-06-11T22:12:19.000Z","updated_at":"2023-09-01T12:11:01.000Z","dependencies_parsed_at":"2022-09-17T04:42:39.271Z","dependency_job_id":null,"html_url":"https://github.com/ckampfe/vector","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ckampfe/vector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Fvector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Fvector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Fvector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Fvector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ckampfe","download_url":"https://codeload.github.com/ckampfe/vector/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckampfe%2Fvector/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268362942,"owners_count":24238543,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-12-06T12:12:39.818Z","updated_at":"2025-08-02T09:32:34.056Z","avatar_url":"https://github.com/ckampfe.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vector\n\nA vector for Elixir backed by Erlang's built-in\n[array](http://erlang.org/doc/man/array.html), providing fast\nrandom access, implementing [Access](https://hexdocs.pm/elixir/Access.html), [Enumerable](https://hexdocs.pm/elixir/Enumerable.html), [Collectable](https://hexdocs.pm/elixir/Collectable.html), and [Inspect](https://hexdocs.pm/elixir/Inspect.html).\n\n[![Build Status](https://travis-ci.org/ckampfe/vector.svg?branch=master)](https://travis-ci.org/ckampfe/vector)\n\n## Installation\n\nThis package is [available on Hex](https://hex.pm/packages/array_vector), and can be installed\nby adding `array_vector` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [{:array_vector, \"~\u003e 0.3\"}]\nend\n```\n\n## Use\n\nFor examples and use, see [the documentation](https://hexdocs.pm/array_vector/Vector.html).\n\n## Development\n\n```elixir\n$ mix run benchmark.exs\n```\n\n## Rationale\n\nYou may want to use this library if:\n\n- you have large, ordered data\n- you want to perform lots of random lookups and updates\n- you want `Access`, `Collectable`, and `Enumerable`, and `Inspect` semantics\n- you'd rather use an immutable collection than `ETS`\n\nElixir's List and Map are great, but they are targeted at linear access and\nrandom, unordered access, respectively.\n\nVector is for when you want both ordered operations and sublinear lookup/updates.\n\n## Limitations\n\nFrom the [array](http://erlang.org/doc/man/array.html) documentation:\n\n```\nThe representation is not documented and is subject to change without notice.\nNotice that arrays cannot be directly compared for equality.\n```\n\nAs such, any equality comparison will be linear time. I'll probably get around to implementing a `Vector.equals?/2` operation at some point. You can always do `Vector.to_list(x) === Vector.to_list(y)` at the expense of converting the underlying `array` to a `list`.\n\n## Benchmark results\n\nMicrobenchmarks are generally trash. This is mostly just to confirm that things are working as expected.\nSee `benchmark.exs` for details.\n\n```\nOperating System: macOS\nCPU Information: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz\nNumber of Available Cores: 8\nAvailable memory: 17.179869184 GB\nElixir 1.4.5\nErlang 20.0\nBenchmark suite executing with the following configuration:\nwarmup: 5.00 s\ntime: 10.00 s\nparallel: 1\ninputs: none specified\nEstimated total run time: 15.00 min\n\n\nBenchmarking list new 1000000...\nBenchmarking vector to_list 10000...\nBenchmarking vector update 1000000...\nBenchmarking list update 1000000...\nBenchmarking vector lookup 100000...\nBenchmarking vector reverse 10000...\nBenchmarking vector lookup 1000000...\nBenchmarking vector new from list 1000...\nBenchmarking vector map + 1 1000...\nBenchmarking vector new raw initialize 1000...\nBenchmarking vector new raw initialize 1000000...\nBenchmarking list reverse 10000...\nBenchmarking list reverse 1000...\nBenchmarking vector lookup 10000000...\nBenchmarking list lookup 10000...\nBenchmarking list map + 1 100000...\nBenchmarking list lookup 10000000...\nBenchmarking vector update 10000000...\nBenchmarking list map + 1 1000000...\nBenchmarking vector map + 1 10000000...\nBenchmarking vector new from list 100000...\nBenchmarking list reverse 1000000...\nBenchmarking list map + 1 10000000...\nBenchmarking vector new raw initialize 100000...\nBenchmarking vector update 10000...\nBenchmarking vector lookup 10000...\nBenchmarking list reverse 10000000...\nBenchmarking vector new from list 10000000...\nBenchmarking list lookup 1000000...\nBenchmarking vector new from list 1000000...\nBenchmarking list new 10000000...\nBenchmarking vector new from list 10000...\nBenchmarking list lookup 100000...\nBenchmarking vector map + 1 1000000...\nBenchmarking vector to_list 100000...\nBenchmarking vector map + 1 100000...\nBenchmarking list update 100000...\nBenchmarking vector new raw initialize 10000...\nBenchmarking list map + 1 1000...\nBenchmarking vector update 100000...\nBenchmarking list update 10000000...\nBenchmarking vector to_list 10000000...\nBenchmarking list new 1000...\nBenchmarking list new 10000...\nBenchmarking vector map + 1 10000...\nBenchmarking vector reverse 1000000...\nBenchmarking vector reverse 100000...\nBenchmarking list map + 1 10000...\nBenchmarking list reverse 100000...\nBenchmarking vector to_list 1000000...\nBenchmarking list new 100000...\nBenchmarking vector reverse 1000...\nBenchmarking vector new raw initialize 10000000...\nBenchmarking list lookup 1000...\nBenchmarking list update 1000...\nBenchmarking vector lookup 1000...\nBenchmarking vector update 1000...\nBenchmarking vector to_list 1000...\nBenchmarking list update 10000...\nBenchmarking vector reverse 10000000...\n\nName                                         ips        average  deviation         median\nvector lookup 1000                    6464726.41       0.155 μs   ±274.26%       0.140 μs\nvector new raw initialize 1000        5860396.12       0.171 μs   ±195.76%       0.160 μs\nvector lookup 10000                   5466636.03       0.183 μs   ±170.40%       0.170 μs\nvector new raw initialize 10000       5312765.81       0.188 μs   ±175.05%       0.170 μs\nvector new raw initialize 100000      4887599.30        0.20 μs   ±164.90%       0.190 μs\nvector lookup 100000                  4500313.00        0.22 μs   ±114.90%        0.20 μs\nvector new raw initialize 10000000    4193030.45        0.24 μs   ±106.02%        0.22 μs\nvector lookup 1000000                 4034980.36        0.25 μs    ±70.77%        0.23 μs\nvector new raw initialize 1000000     3837327.86        0.26 μs  ±3299.96%        0.20 μs\nvector lookup 10000000                3228157.67        0.31 μs   ±472.50%        0.28 μs\nvector update 1000                    2255899.67        0.44 μs    ±48.03%        0.41 μs\nvector update 10000                   1910655.87        0.52 μs    ±26.15%        0.48 μs\nvector update 100000                  1488714.34        0.67 μs   ±795.60%        0.60 μs\nvector update 1000000                 1311684.48        0.76 μs    ±70.97%        0.67 μs\nvector update 10000000                 861867.99        1.16 μs  ±7100.42%        1.00 μs\nlist lookup 1000                       538176.92        1.86 μs   ±159.90%        1.70 μs\nlist reverse 1000                      327210.85        3.06 μs    ±43.49%        2.50 μs\nlist update 1000                       196502.89        5.09 μs    ±24.80%        4.70 μs\nvector to_list 1000                     57372.83       17.43 μs    ±79.76%       16.00 μs\nvector new from list 1000               40466.37       24.71 μs    ±30.47%       23.00 μs\nlist new 1000                           35675.23       28.03 μs    ±50.50%       25.00 μs\nlist reverse 10000                      24634.15       40.59 μs    ±75.05%       25.00 μs\nvector map + 1 1000                     18064.10       55.36 μs    ±19.92%       53.00 μs\nlist lookup 10000                       15703.65       63.68 μs    ±32.76%       59.00 μs\nlist map + 1 1000                       11953.95       83.65 μs    ±22.92%       78.00 μs\nvector reverse 1000                     11173.90       89.49 μs    ±21.14%       85.00 μs\nlist update 10000                        6083.59      164.38 μs    ±16.87%      160.00 μs\nvector to_list 10000                     4949.35      202.05 μs    ±21.69%      183.00 μs\nvector new from list 10000               3404.03      293.77 μs    ±36.33%      264.00 μs\nlist new 10000                           3118.23      320.70 μs    ±21.48%      311.00 μs\nlist reverse 100000                      2532.00      394.94 μs    ±79.38%      232.00 μs\nlist lookup 100000                       1928.03      518.66 μs    ±18.65%      476.00 μs\nvector map + 1 10000                     1583.21      631.63 μs    ±22.54%      573.00 μs\nlist map + 1 10000                       1177.98      848.91 μs    ±15.72%      834.00 μs\nvector reverse 10000                      829.62     1205.38 μs    ±23.93%     1081.00 μs\nlist update 100000                        650.67     1536.88 μs     ±7.08%     1514.00 μs\nvector to_list 100000                     529.95     1886.97 μs    ±14.25%     1995.00 μs\nlist new 100000                           319.84     3126.58 μs    ±15.82%     3276.00 μs\nvector new from list 100000               254.60     3927.78 μs    ±28.77%     3527.00 μs\nlist lookup 1000000                       169.87     5886.73 μs    ±14.93%     5439.00 μs\nvector map + 1 100000                     158.98     6290.27 μs    ±12.13%     5924.00 μs\nlist reverse 1000000                      100.69     9931.31 μs    ±46.44%     9099.00 μs\nlist map + 1 100000                        88.38    11315.04 μs    ±16.46%    11164.50 μs\nvector reverse 100000                      71.16    14052.05 μs    ±15.67%    13752.00 μs\nlist lookup 10000000                       65.54    15257.65 μs    ±11.04%    14829.00 μs\nlist update 1000000                        32.93    30370.29 μs     ±6.21%    29811.00 μs\nvector to_list 1000000                     32.03    31224.72 μs    ±25.98%    29335.00 μs\nvector new from list 1000000               23.83    41962.28 μs    ±26.28%    36328.00 μs\nlist update 10000000                       16.47    60719.26 μs    ±21.23%    61108.00 μs\nlist new 1000000                           13.97    71566.26 μs     ±4.32%    71299.00 μs\nvector map + 1 1000000                     13.73    72812.56 μs    ±12.65%    69022.00 μs\nlist map + 1 1000000                        8.18   122219.85 μs    ±12.67%   119922.50 μs\nlist reverse 10000000                       6.64   150527.52 μs    ±45.15%   135144.00 μs\nvector reverse 1000000                      6.55   152588.91 μs    ±15.31%   143807.50 μs\nvector to_list 10000000                     3.54   282089.33 μs    ±21.21%   270121.50 μs\nlist new 10000000                           1.80   555152.33 μs    ±38.68%   512246.00 μs\nvector new from list 10000000               1.71   583588.88 μs    ±15.54%   616824.00 μs\nvector map + 1 10000000                     1.18   848710.67 μs    ±14.01%   822347.00 μs\nlist map + 1 10000000                       0.72  1384228.88 μs    ±14.75%  1378561.50 μs\nvector reverse 10000000                     0.57  1740072.50 μs     ±9.61%  1773625.00 μs\n\nComparison:\nvector lookup 1000                    6464726.41\nvector new raw initialize 1000        5860396.12 - 1.10x slower\nvector lookup 10000                   5466636.03 - 1.18x slower\nvector new raw initialize 10000       5312765.81 - 1.22x slower\nvector new raw initialize 100000      4887599.30 - 1.32x slower\nvector lookup 100000                  4500313.00 - 1.44x slower\nvector new raw initialize 10000000    4193030.45 - 1.54x slower\nvector lookup 1000000                 4034980.36 - 1.60x slower\nvector new raw initialize 1000000     3837327.86 - 1.68x slower\nvector lookup 10000000                3228157.67 - 2.00x slower\nvector update 1000                    2255899.67 - 2.87x slower\nvector update 10000                   1910655.87 - 3.38x slower\nvector update 100000                  1488714.34 - 4.34x slower\nvector update 1000000                 1311684.48 - 4.93x slower\nvector update 10000000                 861867.99 - 7.50x slower\nlist lookup 1000                       538176.92 - 12.01x slower\nlist reverse 1000                      327210.85 - 19.76x slower\nlist update 1000                       196502.89 - 32.90x slower\nvector to_list 1000                     57372.83 - 112.68x slower\nvector new from list 1000               40466.37 - 159.76x slower\nlist new 1000                           35675.23 - 181.21x slower\nlist reverse 10000                      24634.15 - 262.43x slower\nvector map + 1 1000                     18064.10 - 357.88x slower\nlist lookup 10000                       15703.65 - 411.67x slower\nlist map + 1 1000                       11953.95 - 540.80x slower\nvector reverse 1000                     11173.90 - 578.56x slower\nlist update 10000                        6083.59 - 1062.65x slower\nvector to_list 10000                     4949.35 - 1306.18x slower\nvector new from list 10000               3404.03 - 1899.14x slower\nlist new 10000                           3118.23 - 2073.21x slower\nlist reverse 100000                      2532.00 - 2553.21x slower\nlist lookup 100000                       1928.03 - 3353.03x slower\nvector map + 1 10000                     1583.21 - 4083.29x slower\nlist map + 1 10000                       1177.98 - 5487.96x slower\nvector reverse 10000                      829.62 - 7792.43x slower\nlist update 100000                        650.67 - 9935.48x slower\nvector to_list 100000                     529.95 - 12198.75x slower\nlist new 100000                           319.84 - 20212.50x slower\nvector new from list 100000               254.60 - 25392.00x slower\nlist lookup 1000000                       169.87 - 38056.09x slower\nvector map + 1 100000                     158.98 - 40664.90x slower\nlist reverse 1000000                      100.69 - 64203.19x slower\nlist map + 1 100000                        88.38 - 73148.61x slower\nvector reverse 100000                      71.16 - 90842.68x slower\nlist lookup 10000000                       65.54 - 98636.52x slower\nlist update 1000000                        32.93 - 196335.65x slower\nvector to_list 1000000                     32.03 - 201859.25x slower\nvector new from list 1000000               23.83 - 271274.66x slower\nlist update 10000000                       16.47 - 392533.43x slower\nlist new 1000000                           13.97 - 462656.32x slower\nvector map + 1 1000000                     13.73 - 470713.27x slower\nlist map + 1 1000000                        8.18 - 790117.92x slower\nlist reverse 10000000                       6.64 - 973119.20x slower\nvector reverse 1000000                      6.55 - 986445.55x slower\nvector to_list 10000000                     3.54 - 1823630.36x slower\nlist new 10000000                           1.80 - 3588907.95x slower\nvector new from list 10000000               1.71 - 3772742.46x slower\nvector map + 1 10000000                     1.18 - 5486682.26x slower\nlist map + 1 10000000                       0.72 - 8948660.97x slower\nvector reverse 10000000                     0.57 - 11249092.65x slower\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fckampfe%2Fvector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fckampfe%2Fvector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fckampfe%2Fvector/lists"}