Add README.md
This commit is contained in:
56
README.md
Normal file
56
README.md
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# Advent of Code 2025
|
||||||
|
|
||||||
|
https://adventofcode.com/2025
|
||||||
|
|
||||||
|
## Building
|
||||||
|
Everything is handled by cmake which most ide's can handle.
|
||||||
|
Make sure you have a compiler (MSVC or GCC), CMake, and make/ninja installed.
|
||||||
|
|
||||||
|
If you're using make to build the project, run the following commands:
|
||||||
|
1. `mkdir build`
|
||||||
|
2. `cd build`
|
||||||
|
3. `cmake .. -G "Unix Makefiles"`
|
||||||
|
4. `make -j <number of threads>`
|
||||||
|
|
||||||
|
If you're using ninja to build the project, run the following commands:
|
||||||
|
1. `mkdir build`
|
||||||
|
2. `cd build`
|
||||||
|
3. `cmake .. -G Ninja`
|
||||||
|
4. `ninja`
|
||||||
|
|
||||||
|
## Directory structure
|
||||||
|
|
||||||
|
- `src`: Contains the source code for each day.
|
||||||
|
- `src/common`: Contains some generalized headers that are used by multiple days.
|
||||||
|
- `src/dayX`: Contains the source code for day `X
|
||||||
|
- `src/dayx/pY`: Contains the source code for part `Y` of day `X`
|
||||||
|
- `input`: Contains the input for each day.
|
||||||
|
|
||||||
|
## Types
|
||||||
|
During this challenge, I plan to have multiple different
|
||||||
|
types of solutions.
|
||||||
|
|
||||||
|
- Normal: A more "normal" solution, opting for more readable code without doing anything fancy.
|
||||||
|
- Faf: The fastest solution I can think of.
|
||||||
|
|
||||||
|
Each solution has its own executable following the following naming convention: `dXpY-type`. Where `X` is the day number, `pY` is the part number, and `type` is the type of solution (Normal omits the type all together Ex: a normal day1 part1 executable would be `d1p1`).
|
||||||
|
|
||||||
|
## Benchmarks
|
||||||
|
|
||||||
|
All benchmarks are running using the timer class defined in `src/common/timer.h`. <br>
|
||||||
|
"Normal" solutions are only run once, as they aren't designed to be as fast as possible.<br>
|
||||||
|
"Faf" solutions are run multiple times to get a more accurate average.<br>
|
||||||
|
All benchmarks include file IO, mostly because everything calculates within single digit microseconds or less.
|
||||||
|
|
||||||
|
All benchmarks are run on a system with the following specs:
|
||||||
|
- CPU: AMD Ryzen 9 8945HS
|
||||||
|
- RAM: 32GB DDR5 6000MHz
|
||||||
|
- SSD: Samsung 990 Pro
|
||||||
|
- OS: Windows 11 24H2
|
||||||
|
- Compiler: gcc version 13.2.0 (x86_64-posix-seh-rev0, Built by MinGW-Builds project)
|
||||||
|
|
||||||
|
| Day | Part | Type | Time (us) | Iterations |
|
||||||
|
|-----|------|--------|-----------|------------|
|
||||||
|
| 1 | 1 | faf | 43 | 100000 |
|
||||||
|
| 1 | 1 | Normal | 483 | 1 |
|
||||||
|
| 1 | 2 | Normal | 472 | 1 |
|
||||||
@@ -30,7 +30,7 @@ public:
|
|||||||
for (const auto &[name, time] : points) {
|
for (const auto &[name, time] : points) {
|
||||||
std::cout << "\t" << name << ": " << std::chrono::duration_cast<std::chrono::milliseconds>(time - start).count() << " ms | " << std::chrono::duration_cast<std::chrono::microseconds>(time - start).count() << " us" << std::endl;
|
std::cout << "\t" << name << ": " << std::chrono::duration_cast<std::chrono::milliseconds>(time - start).count() << " ms | " << std::chrono::duration_cast<std::chrono::microseconds>(time - start).count() << " us" << std::endl;
|
||||||
}
|
}
|
||||||
std::cout << "Global: " << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() / iterations << " ms | " << std::chrono::duration_cast<std::chrono::microseconds>(end-start).count() / iterations << " us" << std::endl;
|
std::cout << "Global (" << iterations << "): " << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() / iterations << " ms | " << std::chrono::duration_cast<std::chrono::microseconds>(end-start).count() / iterations << " us" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
constexpr int iterations = 1000;
|
constexpr int iterations = 100000;
|
||||||
Timer timer(iterations);
|
Timer timer(iterations);
|
||||||
int password = 0;
|
int password = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user