{"id":19708811,"url":"https://github.com/willkill07/adventofcode2021","last_synced_at":"2025-10-04T07:55:37.463Z","repository":{"id":45646668,"uuid":"434037739","full_name":"willkill07/AdventOfCode2021","owner":"willkill07","description":"My solutions to https://adventofcode.com/2021","archived":false,"fork":false,"pushed_at":"2021-12-23T02:10:23.000Z","size":187,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-11T08:16:53.063Z","etag":null,"topics":["advent-of-code","advent-of-code-2021","benchmark","cpp","cpp20","openmp"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willkill07.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":"2021-12-02T01:06:03.000Z","updated_at":"2022-12-01T08:07:50.000Z","dependencies_parsed_at":"2022-08-31T20:11:27.305Z","dependency_job_id":null,"html_url":"https://github.com/willkill07/AdventOfCode2021","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/willkill07/AdventOfCode2021","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willkill07%2FAdventOfCode2021","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willkill07%2FAdventOfCode2021/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willkill07%2FAdventOfCode2021/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willkill07%2FAdventOfCode2021/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willkill07","download_url":"https://codeload.github.com/willkill07/AdventOfCode2021/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willkill07%2FAdventOfCode2021/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278283453,"owners_count":25961311,"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-10-04T02:00:05.491Z","response_time":63,"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":["advent-of-code","advent-of-code-2021","benchmark","cpp","cpp20","openmp"],"created_at":"2024-11-11T21:45:00.347Z","updated_at":"2025-10-04T07:55:37.406Z","avatar_url":"https://github.com/willkill07.png","language":"C++","readme":"# AdventOfCode 2021\n\n[![C/C++ CI](https://github.com/willkill07/AdventOfCode2021/actions/workflows/cmake.yml/badge.svg)](https://github.com/willkill07/AdventOfCode2021/actions/workflows/cmake.yml)\n\n## Dependencies\n\n- A C++20 compiler with `std::ranges` support (tested with GCC 11)\n- `cmake`\n- `git`\n- a Unix-like operating system (tested on ArchLinux and macOS)\n- `ninja` (optional)\n\n## Downloading\n\n```\ngit clone --recursive https://github.com/willkill07/AdventOfCode2021.git\n```\n\n## Building\n\nIf you have `ninja` and want a fast(er) build:\n\n```\ncmake -B build -DCMAKE_BUILD_TYPE=Release -G Ninja\ncmake --build build --parallel\n```\n\nIf you don't, just use the Makefile generator:\n\n```\ncmake -B build -DCMAKE_BUILD_TYPE=Release\ncmake --build build --parallel\n```\n\n## Running\n\nAn `advent` binary lives under the `build` directory.\nInvoking it will run all days and report only the answers.\n\nThere are some command-line options available:\n\n```\nUsage: advent [options] \n\nOptional arguments:\n-h --help       shows help message and exits [default: false]\n-v --version    prints version information and exits [default: false]\n--mode          execute with mode (one of: run, time, benchmark) [default: \"run\"]\n--day           day to run (0 for all) [default: 0]\n--part          part to run (1, 2, or 3 [for all]) [default: 3]\n--ntimes        number of times to run (for benchmarking) [default: 10]\n```\n\n#### Running a single day\n\n```\n./build/advent --day N\n```\n\n#### Running a specific part\n\n```\n./build/advent --part 1\n./build/advent --part 2\n```\n\n#### Timing execution\n\n```\n./build/advent --mode time\n```\n\n#### Benchmarking\n\n```\n./build/advent --mode benchmark --ntimes 1000\n```\n\n#### Pulling it all together\n\nYou can combine various parts together.\nFor example, if you want to benchmark day 5 part 2 10K times and report the average:\n```\n./build/advent --mode benchmark --ntimes 10000 --day 5 --part 2\n```\n\n## Performance\n\n#### AMD Ryzen 9 5950X\n\n```\n$ cmake -B build -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -G Ninja -DCMAKE_CXX_FLAGS='-march=native'\n$ cmake --build build -j\n$ OMP_NUM_THREADS=16 OMP_PLACES=cores OMP_PROC_BIND=true KMP_AFFINITY=compact ./build/advent --mode benchmark --ntimes 1000\n+-----------+--------------+--------------+--------------+--------------+                                                                   \n| AoC++2021 |   Parsing    |    Part 1    |    Part 2    |    Total     |                                                                   \n+-----------+--------------+--------------+--------------+--------------+                                                                   \n|  Day 01   |     7.088 us |     0.087 us |     0.086 us |     7.261 us |                                                                   \n|  Day 02   |    15.545 us |     0.681 us |     0.687 us |    16.912 us |                                                                   \n|  Day 03   |    10.900 us |     1.349 us |     3.776 us |    16.025 us |                                                                   \n|  Day 04   |    15.941 us |    17.855 us |    48.923 us |    82.718 us |                                                                   \n|  Day 05   |    11.893 us |   146.052 us |   280.331 us |   438.277 us |                                                                   \n|  Day 06   |     2.746 us |     0.006 us |     0.006 us |     2.757 us |                                                                   \n|  Day 07   |     4.456 us |    10.299 us |    26.293 us |    41.048 us |                                                                   \n|  Day 08   |    48.344 us |     0.231 us |     6.578 us |    55.153 us |                                                                   \n|  Day 09   |     2.749 us |     9.991 us |    59.558 us |    72.299 us |                                                                   \n|  Day 10   |     7.429 us |     8.553 us |     8.987 us |    24.968 us |                                                                   \n|  Day 11   |     2.282 us |    17.146 us |    37.591 us |    57.018 us |                                                                   \n|  Day 12   |     5.463 us |     2.663 us |    33.153 us |    41.279 us |                                                                   \n|  Day 13   |     6.321 us |     8.578 us |    12.133 us |    27.031 us |                                                                   \n|  Day 14   |     2.548 us |     1.049 us |     3.970 us |     7.567 us |                                                                   \n|  Day 15   |     2.873 us |   193.819 us |  6778.715 us |  6975.408 us |                                                                   \n|  Day 16   |    22.241 us |     0.446 us |     0.545 us |    23.232 us |                                                                   \n|  Day 17   |     2.272 us |     0.005 us |   117.415 us |   119.693 us |                                                                   \n|  Day 18   |     7.438 us |   208.303 us |   404.479 us |   620.220 us |                                                                   \n|  Day 19   |    16.504 us | 13272.444 us |    28.233 us | 13317.182 us |                                                                   \n|  Day 20   |    16.599 us |    26.968 us |  1343.362 us |  1386.928 us |                                                                   \n|  Day 21   |     5.458 us |     0.226 us |    79.750 us |    85.433 us |                                                                   \n|  Day 22   |    12.154 us |  1047.457 us |  1051.753 us |  2111.364 us |                                                                   \n+-----------+--------------+--------------+--------------+--------------+                                                                   \n|  Summary  |   229.244 us | 14974.208 us | 10326.323 us | 25529.774 us |                                                                   \n+-----------+--------------+--------------+--------------+--------------+ \n```\n\n#### Apple M1 Pro\n\nNote: multi-threaded times appear to be sequential(?!?!)\n\n```\n$ cmake -B build -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -G Ninja\n$ cmake --build build -j\n$ OMP_NUM_THREADS=8 OMP_PLACES=cores OMP_PROC_BIND=true KMP_AFFINITY=compact ./build/advent --mode benchmark --ntimes 1000\n+-----------+--------------+--------------+--------------+--------------+\n| AoC++2021 |   Parsing    |    Part 1    |    Part 2    |    Total     |\n+-----------+--------------+--------------+--------------+--------------+\n|  Day 01   |    28.930 us |     0.500 us |     0.490 us |    29.920 us |\n|  Day 02   |    22.470 us |     4.650 us |     8.090 us |    35.210 us |\n|  Day 03   |    28.030 us |     5.760 us |    10.980 us |    44.770 us |\n|  Day 04   |    33.510 us |    21.610 us |    70.390 us |   125.510 us |\n|  Day 05   |    27.000 us |   151.560 us |   223.820 us |   402.380 us |\n|  Day 06   |     8.540 us |     0.000 us |     0.010 us |     8.550 us |\n|  Day 07   |    10.890 us |    38.750 us |    82.570 us |   132.210 us |\n|  Day 08   |    29.380 us |     0.290 us |     7.170 us |    36.840 us |\n|  Day 09   |     7.490 us |    24.950 us |    52.350 us |    84.790 us |\n|  Day 10   |    13.100 us |    20.100 us |    10.760 us |    43.960 us |\n|  Day 11   |     7.240 us |    13.320 us |    29.090 us |    49.650 us |\n|  Day 12   |    11.380 us |     3.110 us |    37.400 us |    51.890 us |\n|  Day 13   |    14.460 us |    10.060 us |    10.980 us |    35.500 us |\n|  Day 14   |     7.810 us |     1.510 us |     4.790 us |    14.110 us |\n|  Day 15   |     7.820 us |   145.690 us |  7024.510 us |  7178.020 us |\n|  Day 16   |    35.740 us |     0.390 us |     0.480 us |    36.610 us |\n|  Day 17   |     7.220 us |     0.000 us |   163.510 us |   170.730 us |\n|  Day 18   |    18.380 us |   272.260 us |  1144.050 us |  1434.690 us |\n|  Day 19   |    30.330 us | 16263.930 us |   288.640 us | 16582.900 us |\n|  Day 20   |    36.030 us |   237.820 us |  7443.720 us |  7717.570 us |\n|  Day 21   |    10.150 us |     0.280 us |    88.110 us |    98.540 us |\n|  Day 22   |    23.520 us |  1213.460 us |  1217.590 us |  2454.570 us |\n+-----------+--------------+--------------+--------------+--------------+\n|  Summary  |   419.420 us | 18430.000 us | 17919.500 us | 36768.920 us |\n+-----------+--------------+--------------+--------------+--------------+\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillkill07%2Fadventofcode2021","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillkill07%2Fadventofcode2021","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillkill07%2Fadventofcode2021/lists"}