{"id":19654310,"url":"https://github.com/aimenux/arraylookupsbenchdemo","last_synced_at":"2025-10-16T17:12:10.249Z","repository":{"id":116559187,"uuid":"330412362","full_name":"aimenux/ArrayLookupsBenchDemo","owner":"aimenux","description":"Benchmarking various ways for array lookups","archived":false,"fork":false,"pushed_at":"2021-01-17T22:52:31.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-10T00:25:59.306Z","etag":null,"topics":["array","benchmarkdotnet","binary-search","hashset","net50","vs19"],"latest_commit_sha":null,"homepage":"","language":"C#","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/aimenux.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2021-01-17T14:41:06.000Z","updated_at":"2021-01-17T22:52:33.000Z","dependencies_parsed_at":"2024-08-09T05:15:57.486Z","dependency_job_id":null,"html_url":"https://github.com/aimenux/ArrayLookupsBenchDemo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimenux%2FArrayLookupsBenchDemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimenux%2FArrayLookupsBenchDemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimenux%2FArrayLookupsBenchDemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimenux%2FArrayLookupsBenchDemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aimenux","download_url":"https://codeload.github.com/aimenux/ArrayLookupsBenchDemo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240962707,"owners_count":19885520,"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","benchmarkdotnet","binary-search","hashset","net50","vs19"],"created_at":"2024-11-11T15:16:54.302Z","updated_at":"2025-10-16T17:12:05.212Z","avatar_url":"https://github.com/aimenux.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![.NET 5](https://github.com/aimenux/ArrayLookupsBenchDemo/workflows/.NET%205/badge.svg)\n\n# ArrayLookupsBenchDemo\n```\nBenchmarking various ways for array lookups\n```\n\nIn this demo, i m using [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet) library in order to benchmark various ways of array lookups :\n\u003e\n\u003e :one: Using array exists\n\u003e\n\u003e :two: Using array contains\n\u003e\n\u003e :three: Using array binary search (used only for sorted arrays)\n\u003e\n\u003e :four: Using hashset contains (copying operation is not benchmarked)\n\u003e\n\nIn order to run benchmarks, type these commands in your favorite terminal :\n\u003e\n\u003e :writing_hand: `.\\App.exe --filter SortedArrayBench`\n\u003e\n\u003e :writing_hand: `.\\App.exe --filter UnsortedArrayBench`\n\u003e\n\n```\n|                 Method |    Size |             Mean |          Error |         StdDev |              Min |              Max | Rank |  Gen 0 | Gen 1 | Gen 2 | Allocated |\n|----------------------- |-------- |-----------------:|---------------:|---------------:|-----------------:|-----------------:|-----:|-------:|------:|------:|----------:|\n|   UsingHashsetContains |    1000 |         6.051 ns |      0.1488 ns |      0.1319 ns |         5.874 ns |         6.249 ns |    1 |      - |     - |     - |         - |\n| UsingArrayBinarySearch |    1000 |        25.052 ns |      0.5276 ns |      0.4935 ns |        24.201 ns |        25.898 ns |    2 |      - |     - |     - |         - |\n|     UsingArrayContains |    1000 |       274.035 ns |      1.3930 ns |      1.2349 ns |       271.018 ns |       276.504 ns |    3 |      - |     - |     - |         - |\n|       UsingArrayExists |    1000 |     2,075.331 ns |     37.0969 ns |     53.2033 ns |     2,009.364 ns |     2,190.756 ns |    4 | 0.0191 |     - |     - |      64 B |\n|                        |         |                  |                |                |                  |                  |      |        |       |       |           |\n|   UsingHashsetContains |   10000 |         4.599 ns |      0.1199 ns |      0.1063 ns |         4.436 ns |         4.775 ns |    1 |      - |     - |     - |         - |\n| UsingArrayBinarySearch |   10000 |        32.041 ns |      0.5991 ns |      0.5604 ns |        31.170 ns |        32.962 ns |    2 |      - |     - |     - |         - |\n|     UsingArrayContains |   10000 |     2,654.858 ns |     52.7464 ns |     99.0706 ns |     2,510.247 ns |     2,907.659 ns |    3 |      - |     - |     - |         - |\n|       UsingArrayExists |   10000 |    20,297.634 ns |    214.6080 ns |    200.7444 ns |    19,833.006 ns |    20,587.407 ns |    4 |      - |     - |     - |      64 B |\n|                        |         |                  |                |                |                  |                  |      |        |       |       |           |\n|   UsingHashsetContains |  100000 |         8.523 ns |      0.2030 ns |      0.3278 ns |         8.008 ns |         9.266 ns |    1 |      - |     - |     - |         - |\n| UsingArrayBinarySearch |  100000 |        43.463 ns |      0.8862 ns |      1.1523 ns |        41.681 ns |        46.342 ns |    2 |      - |     - |     - |         - |\n|     UsingArrayContains |  100000 |    24,873.798 ns |    418.8811 ns |    498.6481 ns |    24,211.707 ns |    26,209.180 ns |    3 |      - |     - |     - |         - |\n|       UsingArrayExists |  100000 |   206,863.225 ns |  4,084.0980 ns |  4,011.1303 ns |   200,836.780 ns |   214,013.611 ns |    4 |      - |     - |     - |      64 B |\n|                        |         |                  |                |                |                  |                  |      |        |       |       |           |\n|   UsingHashsetContains | 1000000 |         4.479 ns |      0.0376 ns |      0.0334 ns |         4.410 ns |         4.548 ns |    1 |      - |     - |     - |         - |\n| UsingArrayBinarySearch | 1000000 |        49.342 ns |      1.0137 ns |      1.6078 ns |        46.913 ns |        53.146 ns |    2 |      - |     - |     - |         - |\n|     UsingArrayContains | 1000000 |   255,489.815 ns |  2,168.8992 ns |  1,693.3338 ns |   252,664.160 ns |   258,128.271 ns |    3 |      - |     - |     - |         - |\n|       UsingArrayExists | 1000000 | 2,088,389.076 ns | 35,228.8179 ns | 32,953.0581 ns | 2,034,711.133 ns | 2,147,592.773 ns |    4 |      - |     - |     - |      64 B |\n```\n\n**`Tools`** : vs19, net 5.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faimenux%2Farraylookupsbenchdemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faimenux%2Farraylookupsbenchdemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faimenux%2Farraylookupsbenchdemo/lists"}