{"id":16339037,"url":"https://github.com/phadej/vec","last_synced_at":"2025-04-10T17:25:27.520Z","repository":{"id":26876603,"uuid":"111125529","full_name":"phadej/vec","owner":"phadej","description":"Nat, Fin, Vec","archived":false,"fork":false,"pushed_at":"2024-05-22T13:30:27.000Z","size":1262,"stargazers_count":23,"open_issues_count":15,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-22T13:45:28.390Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phadej.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"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-11-17T16:27:02.000Z","updated_at":"2024-05-22T13:45:30.384Z","dependencies_parsed_at":"2022-07-27T08:52:36.097Z","dependency_job_id":"222d4098-de89-4b35-8650-ef21a9156e5b","html_url":"https://github.com/phadej/vec","commit_stats":{"total_commits":136,"total_committers":7,"mean_commits":"19.428571428571427","dds":"0.044117647058823484","last_synced_commit":"4367d77c5c5d96a0d3ae9a5eb24ea74aa1036a78"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phadej%2Fvec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phadej%2Fvec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phadej%2Fvec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phadej%2Fvec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phadej","download_url":"https://codeload.github.com/phadej/vec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248261968,"owners_count":21074229,"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":[],"created_at":"2024-10-10T23:53:22.298Z","updated_at":"2025-04-10T17:25:27.500Z","avatar_url":"https://github.com/phadej.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fin and vec\n\n## Vec\n\n`vec` provides few approache to work with `Vec`:\n- `naive`: explicit recusion\n    - no need to keep constraints around for most functions\n    - simple\n    - slow\n- `pull`: `Vec n a` represented as `Fin n -\u003e a`\n    - Fuses well\n    - Some code is hard to write (e.g. `Traversable`)\n    - relatively simple\n- `inline`, using `InlineInduction`:\n    - exploits how GHC dictionary resolution works\n    - makes code to unroll completely for staticaly known sizes\n    - fast in that case\n\n## Dependencies\n\n![](https://raw.githubusercontent.com/phadej/vec/master/deps.png)\n\nAnd with dependency flags turned off:\n\n![](https://raw.githubusercontent.com/phadej/vec/master/deps-mini.png)\n\n\n## Benchmarks: dotProduct\n\n- `list` version sets the baseline, built-in fusion seems to kick in.\n- `vector` and `unboxed` vector are 3x slower.\n- *this library*, naive `vec` is even slower\n- `Data.Vec.Pull` approach is slower, *except*\n- that without conversions it's up to speed with `vector`\n- `inline` (using `InlineInduction` over size) is *faster* than list version.\n\n```\nbenchmarking dot product/list\ntime                 23.73 ns   (23.61 ns .. 23.88 ns)\n                     1.000 R²   (1.000 R² .. 1.000 R²)\nmean                 23.69 ns   (23.58 ns .. 23.89 ns)\nstd dev              450.1 ps   (292.0 ps .. 731.3 ps)\nvariance introduced by outliers: 27% (moderately inflated)\n\nbenchmarking dot product/vector\ntime                 80.74 ns   (80.16 ns .. 81.42 ns)\n                     0.999 R²   (0.999 R² .. 1.000 R²)\nmean                 80.83 ns   (80.23 ns .. 82.21 ns)\nstd dev              2.760 ns   (1.657 ns .. 4.830 ns)\nvariance introduced by outliers: 53% (severely inflated)\n\nbenchmarking dot product/unboxed\ntime                 79.95 ns   (79.34 ns .. 80.74 ns)\n                     0.999 R²   (0.999 R² .. 1.000 R²)\nmean                 80.44 ns   (79.61 ns .. 82.51 ns)\nstd dev              4.278 ns   (2.029 ns .. 7.869 ns)\nvariance introduced by outliers: 74% (severely inflated)\n\nbenchmarking dot product/vec\ntime                 130.2 ns   (129.0 ns .. 131.6 ns)\n                     0.999 R²   (0.999 R² .. 1.000 R²)\nmean                 130.1 ns   (129.1 ns .. 131.7 ns)\nstd dev              4.185 ns   (3.108 ns .. 5.425 ns)\nvariance introduced by outliers: 49% (moderately inflated)\n\nbenchmarking dot product/pull\ntime                 245.3 ns   (245.1 ns .. 245.5 ns)\n                     1.000 R²   (0.999 R² .. 1.000 R²)\nmean                 246.3 ns   (244.7 ns .. 254.1 ns)\nstd dev              9.924 ns   (409.7 ps .. 22.69 ns)\nvariance introduced by outliers: 59% (severely inflated)\n\nbenchmarking dot product/pull'\ntime                 71.18 ns   (70.73 ns .. 71.64 ns)\n                     1.000 R²   (1.000 R² .. 1.000 R²)\nmean                 70.79 ns   (70.44 ns .. 71.30 ns)\nstd dev              1.397 ns   (925.3 ps .. 2.095 ns)\nvariance introduced by outliers: 27% (moderately inflated)\n\nbenchmarking dot product/inline\ntime                 20.91 ns   (20.64 ns .. 21.25 ns)\n                     0.999 R²   (0.998 R² .. 0.999 R²)\nmean                 21.12 ns   (20.90 ns .. 21.37 ns)\nstd dev              784.4 ps   (575.5 ps .. 1.107 ns)\nvariance introduced by outliers: 60% (severely inflated)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphadej%2Fvec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphadej%2Fvec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphadej%2Fvec/lists"}