int2str πŸ‡ΊπŸ‡¦

int2str πŸ‡ΊπŸ‡¦

@int2str.net

33 followers14 following97 posts

F1 is officially over in 2030 😭 With a return to V8s, it might as well be called a vintage racing series then... NASCAR is going to look innovative in comparison... *sigh*

Finally figured out how to make my "Utils::views::nm" play nicely with C++23 ranges/views. This makes the final #AdventOfCode problem super nice in C++! I need to do a proper write-up on both the AoC problem, as well as the difficulties of making a C++23 custom view....

I've completed "Code Chronicle" - Day 25 - Advent of Code 2024 #AdventOfCode Man, if I could just turn my mn_const_view() into an actual view, this would actually have been a "one liner" in C++ :) Thank you, AoC team and participants! Merry x-mas and happy holidays!!!!!!

"Crossed Wires" - Day 24 - Advent of Code 2024 #AdventOfCode Ohhhhh nooooo AoC - I'm almost done writing a completely unnecessary, overkill JIT compiler for Day 17.... Don't make me write another one!!! :p

I've completed "Monkey Market" - Day 22 - Advent of Code 2024 #AdventOfCode Day 22 was an absolute breeze and a blast, after 21 was a thorough kick in the pants for me... Both done now and officially caught up! Always fun to use fold_left() weirdly :) Hopefully, no more hard ones 'til x-mas :D

I keep running in the issue that std::unordered_map<> in C++ is slow. Yes, maps are super convenient (I see you, my Python friends...), but they are not free and can hide their complexity. Using a flat array and a bitset, Day 22 went from my slowest to be super fast! #AdventOfCode

I've completed "LAN Party" - Day 23 - Advent of Code 2024 #AdventOfCode Maybe it's the embedded programmer in me, but I always gravitate towards bit-masks for problems like these. No recursion, no graph theory etc., just a bunch of bits...

Alright, that escalated quickly! #AdventOfCode After finishing Day 17 four days ago, I went back and actually implemented a JIT compiler that reads the program from file and emits x86_64 assembly :D Works for the quine, sample and my input and is blazingly fast! TOTAL overkill but fun learning!!

I've completed "Race Condition" - Day 20 - Advent of Code 2024 #AdventOfCode Hmmmm, this is now by far my longest running algorithm for AoC. N*M is never pretty, I guess. I am probably missing an obvious shortcut somewhere (pun intended ;) ) ...

Fixed the performance issue! Turns out the algorithm was fine, but the C++ std::unordered_map<> (specifically the hashing) is slow... Switched to a plain array to store distances and voila... #AdventOfCode

Went back and optimized "Day 7 - Bridge Repair" by writing my own concatenate operator. It's not that I am smarter than std::format, it's just that I have a much smaller problem space :D All 13 days so far now execute in ~200ms, running sample AND final input calculations. #AdventOfCode

Switched from std::unordered_map<> to std::bitset<> to keep track of obstacles and places the guard has visited. As a result, the runtime went from ~15 seconds to: real 0m0.314s user 0m0.310s sys 0m0.004s For both parts! And I think most of it is file loading at this point :D