<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
        <title>Tim Visée</title>
        <link>https://timvisee.com</link>
        <description>Personal portfolio and blog of Tim Visée</description>
        <generator>Zola</generator>
        <language>en</language>
        <atom:link href="https://timvisee.com/tags/rust/rss.xml" rel="self" type="application/rss+xml"/>
        <lastBuildDate>Mon, 11 Oct 2021 00:00:00 +0000</lastBuildDate>
        
            <item>
                <title>Merge Mania</title>
                <pubDate>Mon, 11 Oct 2021 00:00:00 +0000</pubDate>
                <link>https://timvisee.com/projects/merge-mania/</link>
                <guid>https://timvisee.com/projects/merge-mania/</guid>
                <description>&lt;p&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;gitlab.com&#x2F;timvisee&#x2F;merge-mania&#x2F;pipelines&quot;&gt;&lt;img src=&quot;https:&#x2F;&#x2F;gitlab.com&#x2F;timvisee&#x2F;merge-mania&#x2F;badges&#x2F;master&#x2F;pipeline.svg&quot; alt=&quot;Build status on GitLab CI&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;merge-mania&quot;&gt;Visit project page on GitHub&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A real-time team based merging&#x2F;trading game to play using your phone.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Played in teams for a set time period&lt;&#x2F;li&gt;
&lt;li&gt;Players, in a team, use their phone to play the game&lt;&#x2F;li&gt;
&lt;li&gt;Each team has &lt;em&gt;money&lt;&#x2F;em&gt;, &lt;em&gt;energy&lt;&#x2F;em&gt; and an inventory grid with their &lt;em&gt;items&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Factory items, on your grid, produce items at a set interval, on your grid&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Merge&lt;&#x2F;strong&gt; two items of the same type into a better item&lt;&#x2F;li&gt;
&lt;li&gt;Discover new items and tiers as you play&lt;&#x2F;li&gt;
&lt;li&gt;Players run between outposts to earn &lt;em&gt;energy&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Energy&lt;&#x2F;em&gt; is used to buy additional &lt;em&gt;factories&lt;&#x2F;em&gt; on the grid, producing new items&lt;&#x2F;li&gt;
&lt;li&gt;Buy lots of factories to gain items as quickly as possible&lt;&#x2F;li&gt;
&lt;li&gt;Merge &amp;amp; sell smart to earn as much as possible&lt;&#x2F;li&gt;
&lt;li&gt;After playing, the team earning the most wins&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;p&gt;
    &lt;a href=&quot;game-main.png&quot; title=&quot;View full-size image&quot;&gt;
        
        
        
        &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;timvisee.com&amp;#x2F;processed_images&amp;#x2F;70b81b10f9129e2700.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
&lt;&#x2F;p&gt;

&lt;p&gt;
    &lt;a href=&quot;game-merge.png&quot; title=&quot;View full-size image&quot;&gt;
        
        
        
        &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;timvisee.com&amp;#x2F;processed_images&amp;#x2F;e93f796b4a524d7400.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
&lt;&#x2F;p&gt;

&lt;p&gt;
    &lt;a href=&quot;game-buy.png&quot; title=&quot;View full-size image&quot;&gt;
        
        
        
        &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;timvisee.com&amp;#x2F;processed_images&amp;#x2F;2088d3ffa74f7ae800.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
&lt;&#x2F;p&gt;

&lt;p&gt;
    &lt;a href=&quot;game-details.png&quot; title=&quot;View full-size image&quot;&gt;
        
        
        
        &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;timvisee.com&amp;#x2F;processed_images&amp;#x2F;164ead0426d2faab00.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
&lt;&#x2F;p&gt;

&lt;p&gt;
    &lt;a href=&quot;game-details-factory.png&quot; title=&quot;View full-size image&quot;&gt;
        
        
        
        &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;timvisee.com&amp;#x2F;processed_images&amp;#x2F;ebc8ffc1656d1b3c00.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
&lt;&#x2F;p&gt;

&lt;p&gt;
    &lt;a href=&quot;game-scan-code.png&quot; title=&quot;View full-size image&quot;&gt;
        
        
        
        &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;timvisee.com&amp;#x2F;processed_images&amp;#x2F;a4af7e0c9bc5b9ec00.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
&lt;&#x2F;p&gt;

&lt;p&gt;
    &lt;a href=&quot;game-stats.png&quot; title=&quot;View full-size image&quot;&gt;
        
        
        
        &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;timvisee.com&amp;#x2F;processed_images&amp;#x2F;a07cc9971e052a7300.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
&lt;&#x2F;p&gt;

&lt;p&gt;
    &lt;a href=&quot;game-leaderboard.png&quot; title=&quot;View full-size image&quot;&gt;
        
        
        
        &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;timvisee.com&amp;#x2F;processed_images&amp;#x2F;2e982d23ce87835b00.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
&lt;&#x2F;p&gt;

&lt;p&gt;
    &lt;a href=&quot;admin.png&quot; title=&quot;View full-size image&quot;&gt;
        
        
        
        &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;timvisee.com&amp;#x2F;processed_images&amp;#x2F;2ca509a82426c81600.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
&lt;&#x2F;p&gt;

&lt;p&gt;
    &lt;a href=&quot;outpost.png&quot; title=&quot;View full-size image&quot;&gt;
        
        
        
        &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;timvisee.com&amp;#x2F;processed_images&amp;#x2F;411f21edb55f8f3800.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
&lt;&#x2F;p&gt;
&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;merge-mania#player-explanation&quot;&gt;Player explanation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;merge-mania#how-to-use&quot;&gt;How to use&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;View more on the project pages over at:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;merge-mania&quot;&gt;GitHub&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;gitlab.com&#x2F;timvisee&#x2F;merge-mania&quot;&gt;GitLab&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</description>
            </item>
        
            <item>
                <title>Solving Advent of Code 2020 in under a second</title>
                <pubDate>Sat, 27 Feb 2021 00:00:00 +0000</pubDate>
                <link>https://timvisee.com/blog/solving-aoc-2020-in-under-a-second/</link>
                <guid>https://timvisee.com/blog/solving-aoc-2020-in-under-a-second/</guid>
                <description>&lt;pre style=&quot;background-color:#191919;color:#f8f8f2;&quot;&gt;&lt;code&gt;&lt;span&gt;       ,--.-----.--.
&lt;&#x2F;span&gt;&lt;span&gt;       |--|-----|--|
&lt;&#x2F;span&gt;&lt;span&gt;       |--|     |--|
&lt;&#x2F;span&gt;&lt;span&gt;       |  |-----|  |
&lt;&#x2F;span&gt;&lt;span&gt;     __|--|     |--|__
&lt;&#x2F;span&gt;&lt;span&gt;    &#x2F;  |  |-----|  |  \              mm    mmmm    mmm
&lt;&#x2F;span&gt;&lt;span&gt;   &#x2F;   \__|-----|__&#x2F;   \             ##   m&amp;quot;  &amp;quot;m m&amp;quot;   &amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt;  &#x2F;   ______---______   \&#x2F;\         #  #  #    # #
&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;   &#x2F;               \   \&#x2F;         #mm#  #    # #
&lt;&#x2F;span&gt;&lt;span&gt;{   &#x2F;    _     _   _  \   }        #    #  #mm#   &amp;quot;mmm&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt;|  { &#x2F;  | | . | | &#x2F;|   }  |-,   
&lt;&#x2F;span&gt;&lt;span&gt;|  | \  |_| . |_| _|_  |  | |    mmmm   mmmm   mmmm   mmmm
&lt;&#x2F;span&gt;&lt;span&gt;|  {                   }  |-&amp;#39;   &amp;quot;   &amp;quot;# m&amp;quot;  &amp;quot;m &amp;quot;   &amp;quot;# m&amp;quot;  &amp;quot;m
&lt;&#x2F;span&gt;&lt;span&gt;{   \                 &#x2F;   }         m&amp;quot; #  m #     m&amp;quot; #  m #
&lt;&#x2F;span&gt;&lt;span&gt; \   `------___------&amp;#39;   &#x2F;\       m&amp;quot;   #    #   m&amp;quot;   #    #
&lt;&#x2F;span&gt;&lt;span&gt;  \     __|-----|__     &#x2F;\&#x2F;     m#mmmm  #mm#  m#mmmm  #mm#
&lt;&#x2F;span&gt;&lt;span&gt;   \   &#x2F;  |-----|  \   &#x2F;
&lt;&#x2F;span&gt;&lt;span&gt;    \  |--|     |--|  &#x2F;
&lt;&#x2F;span&gt;&lt;span&gt;     --|  |-----|  |--
&lt;&#x2F;span&gt;&lt;span&gt;       |--|     |--|
&lt;&#x2F;span&gt;&lt;span&gt;       |--|-----|--|
&lt;&#x2F;span&gt;&lt;span&gt;       `--&amp;#39;-----`--&amp;#39;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;&quot;&gt;Advent of Code&lt;&#x2F;a&gt; is a popular yearly programming competition. It&#x27;s an
Advent calendar of small programming puzzles for a variety of skill sets and
levels that can be solved in any programming language you like.&lt;&#x2F;p&gt;
&lt;p&gt;Puzzles are released daily throughout December. &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;stats&quot;&gt;More&lt;&#x2F;a&gt; than 150k
people take part in this event. The toughest battle to solve each puzzle as soon
as possible to become the best on the global &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;leaderboard&quot;&gt;leaderboard&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In my timezone, puzzles are released at 6 o&#x27;clock in the morning. Since I&#x27;m a
night owl, the biggest challenge for me here is to get up so early. I,
therefore, set a different goal instead.&lt;&#x2F;p&gt;
&lt;span id=&quot;continue-reading&quot;&gt;&lt;&#x2F;span&gt;&lt;h2 id=&quot;subsecond&quot;&gt;Subsecond
    &lt;a class=&quot;anchor&quot; href=&quot;#subsecond&quot; aria-label=&quot;Anchor link for: subsecond&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;I want to develop a standalone, short, compact, fast and, elegant solution for
each problem this year. In past competitions, I took part using the &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.rust-lang.org&#x2F;&quot;&gt;Rust&lt;&#x2F;a&gt;
language. I&#x27;ve been using it a lot for other projects lately, and believe it is
a fantastic language to build performant, secure, and robust software. This has
always sparked my interest so Rust is a good fit.&lt;&#x2F;p&gt;
&lt;p&gt;Last year I came across &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.forrestthewoods.com&#x2F;blog&#x2F;solving-advent-of-code-in-under-a-second&#x2F;&quot;&gt;this&lt;&#x2F;a&gt; article, solving all puzzles in
under a second. Yes, in less than one second total. This inspired me to
challenge myself to the same this year:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Solving Advent of Code 2020 in under a second on a single CPU core.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Spoiler alert: I succeeded!&lt;&#x2F;p&gt;
&lt;h2 id=&quot;what-s-in-this-for-you&quot;&gt;What&#x27;s in this for you?
    &lt;a class=&quot;anchor&quot; href=&quot;#what-s-in-this-for-you&quot; aria-label=&quot;Anchor link for: what-s-in-this-for-you&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;In this article, I&#x27;d like to show you some optimizations I found appealing which
I used to keep the solutions blazingly fast. I&#x27;ll only talk about the most
significant optimizations and the interesting bits. Most are algorithmic and are
consequently language agnostic.&lt;&#x2F;p&gt;
&lt;p&gt;I&#x27;m just using basic time measurements on my machine. I won&#x27;t be theoretically
proving the efficiency of an approach. I optimized the runtime of my solutions
based on my personal input. I did not make assumptions other than what is clear
from the puzzle description though, so each solution should work for all inputs
with comparable runtime. All user input is similar after all.&lt;&#x2F;p&gt;
&lt;p&gt;I hope this article will present you with some out-of-the-box approaches you can
take away to make your future code more performant. Hence this piece is intended
for programmers that value performance.&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#191919;color:#f8f8f2;&quot;&gt;&lt;code&gt;&lt;span&gt;                     )
&lt;&#x2F;span&gt;&lt;span&gt;       CHOO CHOO     &amp;#39; ))&amp;#39;
&lt;&#x2F;span&gt;&lt;span&gt;                      {&#x2F;&#x2F;  &amp;#39;&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt;                           &amp;quot;&amp;#39;&amp;#39; )
&lt;&#x2F;span&gt;&lt;span&gt; ___   ___  ____ ____ ____ __||_
&lt;&#x2F;span&gt;&lt;span&gt;____ -- __ {___{{___{{___{(___(o)
&lt;&#x2F;span&gt;&lt;span&gt; ---- ----  0 0  0 0  0 0  0 0&amp;#39;U&amp;#39;
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;        code zooming past
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;source-code&quot;&gt;Source code
    &lt;a class=&quot;anchor&quot; href=&quot;#source-code&quot; aria-label=&quot;Anchor link for: source-code&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;Source code and measurements? See my solutions on GitHub:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If you&#x27;d like to give these &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;&quot;&gt;puzzles&lt;&#x2F;a&gt; a try and haven&#x27;t done so yet, I highly
recommend doing so before you continue reading. It contains
spoilers.&lt;&#x2F;p&gt;
&lt;p&gt;Now, let&#x27;s get started with the interesting stuff.&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;h2 id=&quot;day-1-report-repair&quot;&gt;Day 1: Report Repair
    &lt;a class=&quot;anchor&quot; href=&quot;#day-1-report-repair&quot; aria-label=&quot;Anchor link for: day-1-report-repair&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;On the first day &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;1#part2&quot;&gt;part 2&lt;&#x2F;a&gt;, we&#x27;re given a list of numbers. We must find 3 numbers
that have a sum of 2020. All numbers are around 1000, so we&#x27;re likely trying to
find a pair of 3 small numbers.&lt;&#x2F;p&gt;
&lt;p&gt;I &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;day01b&#x2F;src&#x2F;main.rs#L6&quot;&gt;sort&lt;&#x2F;a&gt; the list of numbers from small to large before trying to
find the correct pair, which decreases the runtime from &lt;code&gt;1.38ms&lt;&#x2F;code&gt; to &lt;code&gt;7μs&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Yup, starting simple.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;day-6-custom-customs&quot;&gt;Day 6: Custom Customs
    &lt;a class=&quot;anchor&quot; href=&quot;#day-6-custom-customs&quot; aria-label=&quot;Anchor link for: day-6-custom-customs&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;On &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;6&quot;&gt;day 6 part 1&lt;&#x2F;a&gt; we&#x27;re trying to find the number of unique questions.
There are 26 in total, represented as letters. I take a 32-bit integer and
&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;day06a&#x2F;src&#x2F;main.rs#L9-L10&quot;&gt;set&lt;&#x2F;a&gt; the corresponding bit for each answer. I then count the number
of ones. No expensive data structures are required.&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#191919;color:#f8f8f2;&quot;&gt;&lt;code&gt;&lt;span&gt;cady:    00000010110000000000000000000010
&lt;&#x2F;span&gt;&lt;span&gt;ipldcyf: 00000000110100100100010000000010
&lt;&#x2F;span&gt;&lt;span&gt;xybgcd:  00000000110010000000000000000110
&lt;&#x2F;span&gt;&lt;span&gt;gcdy:    00000000110010000000000000000010
&lt;&#x2F;span&gt;&lt;span&gt;dygbc:   00000001110010000000000000000010
&lt;&#x2F;span&gt;&lt;span&gt;         =OR=============================
&lt;&#x2F;span&gt;&lt;span&gt;         00000011110110100100010000000110 -&amp;gt; 11
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;6#part2&quot;&gt;Part 2&lt;&#x2F;a&gt; is simple now: I take the same approach but &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;f41a0bdbce584cf160800dbebb5c49ee3023a592&#x2F;day06b&#x2F;src&#x2F;main.rs#L8-L10&quot;&gt;use&lt;&#x2F;a&gt;
the AND operation instead of OR when setting bits.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;day-9-encoding-error&quot;&gt;Day 9: Encoding Error
    &lt;a class=&quot;anchor&quot; href=&quot;#day-9-encoding-error&quot; aria-label=&quot;Anchor link for: day-9-encoding-error&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;On &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;9#part2&quot;&gt;day 9 part 2&lt;&#x2F;a&gt; we must find a sequence of numbers in a list of
numbers that sums up to a specific value.&lt;&#x2F;p&gt;
&lt;p&gt;The common approach seems to be to use a &lt;code&gt;for&lt;&#x2F;code&gt; in a &lt;code&gt;for&lt;&#x2F;code&gt; loop. This walks
over each position with the outer loop and tries to find a sequence with the
correct sum with the inner loop.&lt;&#x2F;p&gt;
&lt;p&gt;I&#x27;m &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;day09b&#x2F;src&#x2F;main.rs#L9-L20&quot;&gt;using&lt;&#x2F;a&gt; a &lt;em&gt;dynamic sliding window&lt;&#x2F;em&gt; approach instead (I better
give it a fancy name you know). I start by sliding the &lt;em&gt;head&lt;&#x2F;em&gt; forward, making
the window and the sum larger. When the sum becomes larger than the target value
I stop. Then I start sliding the &lt;em&gt;tail&lt;&#x2F;em&gt; forward, making the window and the
sequence sum smaller. When the sum becomes smaller than the target value I stop.&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#191919;color:#f8f8f2;&quot;&gt;&lt;code&gt;&lt;span&gt;   &amp;gt;&amp;gt; tail &amp;gt;&amp;gt;     &amp;gt;&amp;gt; head &amp;gt;&amp;gt;
&lt;&#x2F;span&gt;&lt;span&gt;         |           |
&lt;&#x2F;span&gt;&lt;span&gt;         +-----------+
&lt;&#x2F;span&gt;&lt;span&gt;... 35 20|15 25 47 40|62 55 65 95 102 ...
&lt;&#x2F;span&gt;&lt;span&gt;         +-----------+
&lt;&#x2F;span&gt;&lt;span&gt;         | tot: 127  |
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;I keep alternating between sliding the &lt;em&gt;head&lt;&#x2F;em&gt; and &lt;em&gt;tail&lt;&#x2F;em&gt;. Once the sum equals
the target value, we&#x27;ve found the sequence and can solve the puzzle. This
minimizes the number of required loops, making it more efficient.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;day-10-adapter-array&quot;&gt;Day 10: Adapter Array
    &lt;a class=&quot;anchor&quot; href=&quot;#day-10-adapter-array&quot; aria-label=&quot;Anchor link for: day-10-adapter-array&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;On &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;10#part2&quot;&gt;day 10 part 2&lt;&#x2F;a&gt; we get a list of adapter voltages. Adapters may be
plugged into each other if the adapter is 1 to 3 volts higher than the adapter
you&#x27;re plugging into. The puzzle is to figure out how many distinct adapter
arrangements are possible.&lt;&#x2F;p&gt;
&lt;p&gt;I started with a sorted list because you can only plug higher-rated adapters
into lower-rated ones. The maximum difference is 3, so I soon discovered that
you can chunk the sequence of adapters. Each chunk of adapters has a difference
of 3, which only gives one way to connect between them. You can now process each
chunk separately to find distinct arrangements, multiplying their calculations.&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#191919;color:#f8f8f2;&quot;&gt;&lt;code&gt;&lt;span&gt;Chunks with adapters:
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;C1 &amp;gt;&amp;gt; C2 &amp;gt;&amp;gt; C3 &amp;gt;&amp;gt; C4 &amp;gt;&amp;gt; C5
&lt;&#x2F;span&gt;&lt;span&gt;--    --    --    --    --
&lt;&#x2F;span&gt;&lt;span&gt;1     4     10    15    19
&lt;&#x2F;span&gt;&lt;span&gt;      5     11    16
&lt;&#x2F;span&gt;&lt;span&gt;      6     12
&lt;&#x2F;span&gt;&lt;span&gt;      7
&lt;&#x2F;span&gt;&lt;span&gt;--    --    --    --    --
&lt;&#x2F;span&gt;&lt;span&gt;1x    7x    4x    2x    1x
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;Ways to connect:
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;1  +  7  +  4  +  2  +  1  =  15
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This resulted in chunks that always consisted of 2, 3, or 4 adapters. This makes
it easy to find distinctions between them. I finally figured that I could
&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;day10b&#x2F;src&#x2F;main.rs#L13-L20&quot;&gt;optimize&lt;&#x2F;a&gt; it to a &lt;em&gt;fixed number of distinctions per chunk size&lt;&#x2F;em&gt;
greatly reducing complexity.&lt;&#x2F;p&gt;
&lt;p&gt;I found 74049191673856 distinct ways to connect all adapters in just &lt;code&gt;5μs&lt;&#x2F;code&gt;. I
can&#x27;t even count to 1 within that time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;day-11-seating-system&quot;&gt;Day 11: Seating System
    &lt;a class=&quot;anchor&quot; href=&quot;#day-11-seating-system&quot; aria-label=&quot;Anchor link for: day-11-seating-system&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;On &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;11&quot;&gt;day 11 part 1&lt;&#x2F;a&gt; we&#x27;re given a variation of &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Conway%27s_Game_of_Life&quot;&gt;Conway&#x27;s Game of
Life&lt;&#x2F;a&gt; represented as a 2D arrangement of seats on a plane. Each iteration
seat occupation changes based on a set of rules considering their neighbors, but
seats don&#x27;t move.&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#191919;color:#f8f8f2;&quot;&gt;&lt;code&gt;&lt;span&gt;L.LL.LL.LL    L = empty seat
&lt;&#x2F;span&gt;&lt;span&gt;LLLLLLL.LL    . = nothing
&lt;&#x2F;span&gt;&lt;span&gt;L.L.L..L..
&lt;&#x2F;span&gt;&lt;span&gt;LLLL.LL.LL
&lt;&#x2F;span&gt;&lt;span&gt;L.LL.LL.LL
&lt;&#x2F;span&gt;&lt;span&gt;L.LLLLL.LL
&lt;&#x2F;span&gt;&lt;span&gt;..L.L.....
&lt;&#x2F;span&gt;&lt;span&gt;LLLLLLLLLL
&lt;&#x2F;span&gt;&lt;span&gt;L.LLLLLL.L
&lt;&#x2F;span&gt;&lt;span&gt;L.LLLLL.LL
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;With regular &lt;em&gt;Game of Life&lt;&#x2F;em&gt; you&#x27;d have to loop through all positions each
iteration and evaluate all rules to determine their new state. Because this
puzzle does not have a seat at every position (nor do seats always have 4
neighbors) our plane is more like a &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Sparse_array&quot;&gt;sparse array&lt;&#x2F;a&gt;. A lot of
cycles would be wasted if we&#x27;d keep looping over all plane positions.&lt;&#x2F;p&gt;
&lt;p&gt;I decided to make a list of all seat positions and their respective neighbors.
&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;day11a&#x2F;src&#x2F;main.rs#L38-L54&quot;&gt;This&lt;&#x2F;a&gt; way I only had to go through this list of seats for each
iteration. Determining what neighbors a seat has just needs to be performed
once.&lt;&#x2F;p&gt;
&lt;p&gt;This is especially great for &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;11#part2&quot;&gt;part 2&lt;&#x2F;a&gt; which makes things worse. It
doesn&#x27;t just consider direct neighbors anymore, but neighbors in line of sight
making searching much more expensive. Luckily it doesn&#x27;t affect my approach from
the first part too much, as I only search &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;day11b&#x2F;src&#x2F;main.rs#L28-L39&quot;&gt;once&lt;&#x2F;a&gt;. This is much more
efficient than looping through all positions and finding neighbors every time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;day-12-rain-risk&quot;&gt;Day 12: Rain Risk
    &lt;a class=&quot;anchor&quot; href=&quot;#day-12-rain-risk&quot; aria-label=&quot;Anchor link for: day-12-rain-risk&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;On &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;12&quot;&gt;day 12 part 1&lt;&#x2F;a&gt; we&#x27;re given a sequence of navigation instructions for
a ship. It includes cardinal directions, rotation, and forward instructions. We
must figure out the distance between the start and destination position.&lt;&#x2F;p&gt;
&lt;p&gt;What makes this tricky is the rotation and forward instructions. The forward
movement is dependent on your current rotation.&lt;&#x2F;p&gt;
&lt;p&gt;I use a single byte of which the first 4 bits define the current rotation. The
first bit means north, the second bit means east, et cetera. Because the ship
starts looking east, I start with the &lt;code&gt;0b01000100&lt;&#x2F;code&gt; pattern. For each rotation
instruction, I simply &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Bitwise_operation#bit_rotation&quot;&gt;rotate&lt;&#x2F;a&gt; the bits left or right. Rotating
right would update the direction to &lt;code&gt;0b00100010&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#191919;color:#f8f8f2;&quot;&gt;&lt;code&gt;&lt;span&gt;Direction bits, shift to rotate 90 degrees left or right:
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;    &amp;lt;&amp;lt; rotate left &amp;lt;&amp;lt;               &amp;gt;&amp;gt; rotate right &amp;gt;&amp;gt;
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;... &amp;lt;&amp;gt; 01000100 &amp;lt;&amp;gt; 00100010 &amp;lt;&amp;gt; 00010001 &amp;lt;&amp;gt; 10001000 &amp;lt;&amp;gt; ...
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;                Bit meaning:
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;              [ y-1 ] [ y+1 ]
&lt;&#x2F;span&gt;&lt;span&gt;              [north] [south]
&lt;&#x2F;span&gt;&lt;span&gt;                    | |
&lt;&#x2F;span&gt;&lt;span&gt;Direction bits  00100010  would move ship south (y+1)
&lt;&#x2F;span&gt;&lt;span&gt;                     | |
&lt;&#x2F;span&gt;&lt;span&gt;                [east] [west]
&lt;&#x2F;span&gt;&lt;span&gt;                [ x+1] [x-1 ]
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To move forward I &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;day12a&#x2F;src&#x2F;main.rs#L12-L18&quot;&gt;take&lt;&#x2F;a&gt; this direction byte and use bitwise
arithmetic to update the ship position. This removes branching (&lt;code&gt;if&lt;&#x2F;code&gt; statements
and such) you&#x27;d normally expect for logic like this. Quite elegant.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;day-13-shuttle-search&quot;&gt;Day 13: Shuttle Search
    &lt;a class=&quot;anchor&quot; href=&quot;#day-13-shuttle-search&quot; aria-label=&quot;Anchor link for: day-13-shuttle-search&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;On &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;13#part2&quot;&gt;day 13 part 2&lt;&#x2F;a&gt; you&#x27;re given a series of bus lines, each having a
fixed schedule. You must find the time where each bus leaves one after
the other, in order.&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#191919;color:#f8f8f2;&quot;&gt;&lt;code&gt;&lt;span&gt;time     bus 7   bus 13  X  X  bus 59  X  bus 31  bus 19
&lt;&#x2F;span&gt;&lt;span&gt;  ...      .       .     .  .    .     .    .       .
&lt;&#x2F;span&gt;&lt;span&gt;1068780    .       .     .  .    .     .    .       .
&lt;&#x2F;span&gt;&lt;span&gt;1068781    D       .     .  .    .     .    .       .
&lt;&#x2F;span&gt;&lt;span&gt;1068782    .       D     .  .    .     .    .       .
&lt;&#x2F;span&gt;&lt;span&gt;1068783    .       .     D  .    .     .    .       .
&lt;&#x2F;span&gt;&lt;span&gt;1068784    .       .     .  D    .     .    .       .
&lt;&#x2F;span&gt;&lt;span&gt;1068785    .       .     .  .    D     .    .       .
&lt;&#x2F;span&gt;&lt;span&gt;1068786    .       .     .  .    .     D    .       .
&lt;&#x2F;span&gt;&lt;span&gt;1068787    .       .     .  .    .     .    D       .
&lt;&#x2F;span&gt;&lt;span&gt;1068788    D       .     .  .    .     .    .       D
&lt;&#x2F;span&gt;&lt;span&gt;1068789    .       .     .  .    .     .    .       .
&lt;&#x2F;span&gt;&lt;span&gt;  ...
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;My initial thought was just to brute force through all times. The correct answer
turns out to be very large (more than 640 trillion), making this impossible
within a short time. I was unable to optimize this myself with basic mathematics
due to the weird constraints.&lt;&#x2F;p&gt;
&lt;p&gt;Searching for the problem semantics and related keywords online revealed the &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Chinese_remainder_theorem&quot;&gt;Chinese Remainder
Theorem&lt;&#x2F;a&gt;. It is very similar to the given problem and shows an efficient
way to solve it with sample code. With minimal changes, I solved this seemingly
impossible puzzle and the solution finds the answer in just &lt;code&gt;4μs&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The important lesson here is that many Advent of Code problems resemble some
well-defined algorithm or at least part of it. If you can&#x27;t solve it yourself,
try to find a suitable algorithm. Finding such an algorithm makes solving the
problem child&#x27;s play. This is super interesting for learning about new
algorithms and approaches as well.&lt;&#x2F;p&gt;
&lt;!--

## Day 14: Docking Data

In [day 14 part 1][d14p1] a bitmask is given. It must be applied to a set of
numbers to find the correct sum. The mask sets both `0` and `1` bits, some bits
are undefined. I transformed it into an AND &amp; OR mask to apply to all the
values. This is computationally cheap, making it a fast solution, and preventing
complex logic to filter all values. Quite an obvious solution reading the puzzle
description.

In [part 2][d14p2] a bitmask is given...

TODO remove this day?

--&gt;
&lt;h2 id=&quot;day-15-rambunctious-recitation&quot;&gt;Day 15: Rambunctious Recitation
    &lt;a class=&quot;anchor&quot; href=&quot;#day-15-rambunctious-recitation&quot; aria-label=&quot;Anchor link for: day-15-rambunctious-recitation&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;15#part2&quot;&gt;Day 15&lt;&#x2F;a&gt; requires you to continue a number sequence to find the number at
a given position. The puzzle description explains the rules quite well. The
second part gets tricky: it asks you the 30 millionth position. The problem is
that for each number you have to traverse all previous numbers based on the
given rules. This becomes super expensive for higher positions. For 30 million
numbers this means traversing 450 trillion (!) numbers.&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#191919;color:#f8f8f2;&quot;&gt;&lt;code&gt;&lt;span&gt;Given: 6, 4, 12, 1, 20, 0, 16
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;                        2back 2back 1back new   new   6back 3back
&lt;&#x2F;span&gt;&lt;span&gt;                        |     |     |     |     |     |     |
&lt;&#x2F;span&gt;&lt;span&gt;6, 4, 12, 1, 20, 0, 16, 0, 2, 0, 2, 2, 1, 9, 0, 5, 0, 2, 6, 0, 3, ...
&lt;&#x2F;span&gt;&lt;span&gt;                    |      |     |     |     |     |     |     |
&lt;&#x2F;span&gt;&lt;span&gt;                    new    new   2back 9back 5back 2back new   new
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The sequence appears to be the &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;ibmathsresources.com&#x2F;2019&#x2F;06&#x2F;12&#x2F;the-van-eck-sequence&#x2F;&quot;&gt;Van Eck sequence&lt;&#x2F;a&gt; (see
&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=etMJxB-igrc&quot;&gt;this&lt;&#x2F;a&gt; fantastic Numberpfile video on it). To my surprise,
there doesn&#x27;t seem to be an efficient algorithm for generating the sequence. The
sequence does not repeat, nor does it have a known pattern that would help with
generating. Many people (a lot smarter than I am) have taken up the challenge to
find a more efficient method, but without result. This means I don&#x27;t have to
give it a try. Instead, I have to be careful to use the correct logic and data
structures to keep my sequence generator as fast as possible.&lt;&#x2F;p&gt;
&lt;p&gt;I opted to &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;day15b&#x2F;src&#x2F;main.rs#L13-L36&quot;&gt;use&lt;&#x2F;a&gt; a lookup table approach with an array and hash map
combination. Because the last position of a number is important, the table is
used for this with the number as a key and the last position as a value. This
way generating the next number only requires a single lookup instead of
traversing all previous numbers.&lt;&#x2F;p&gt;
&lt;p&gt;Instead of just using a fixed array or hash map for the lookup table as a whole,
I split it in a low and high side at the 3 million mark. The low side is a fixed
array, the high side utilizes a hash map. This turns out to be much faster than
using just either of the two, improving runtime by 30%. This is super
interesting to me, and I didn&#x27;t expect it to be so much faster. It likely has to
do with more efficient CPU cache usage on my system, where the low side with the
array is dense, and the high side with the hash map is sparse, though I haven&#x27;t
looked into the details. This shows that using a single data structure isn&#x27;t
always the best approach, even though that might be against your expectations.&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#191919;color:#f8f8f2;&quot;&gt;&lt;code&gt;&lt;span&gt;Sequence example:
&lt;&#x2F;span&gt;&lt;span&gt;6, 4, 12, 1, 20, 0, 16, 0, 2, 0, 2, 2, 1, 9, 0, 5, 0, 2, 6, 0, 3, ...
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;Last position lookup tables:
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;LOW SIDE ARRAY 0..3M    HIGH SIDE MAP 3M..30M
&lt;&#x2F;span&gt;&lt;span&gt;+-------+----------+    +------+------------+
&lt;&#x2F;span&gt;&lt;span&gt;| index | last pos |    | num  | last pos   |
&lt;&#x2F;span&gt;&lt;span&gt;+-------+----------+    +------+------------+
&lt;&#x2F;span&gt;&lt;span&gt;| 0     | 20       |    | 3M   | 3.2M       |
&lt;&#x2F;span&gt;&lt;span&gt;| 1     | 13       |    | 3.2M | 8.3M       |
&lt;&#x2F;span&gt;&lt;span&gt;| 2     | 18       |    | 3.5M | 9.1M       |
&lt;&#x2F;span&gt;&lt;span&gt;| 3     | 21       |    | 3.6M | 4.9M       |
&lt;&#x2F;span&gt;&lt;span&gt;| 4     | 2        |    | 3.7M | 11.2M      |
&lt;&#x2F;span&gt;&lt;span&gt;| 5     | 16       |    | ..   | ..         |
&lt;&#x2F;span&gt;&lt;span&gt;| ..    | ..       |    |      |            |
&lt;&#x2F;span&gt;&lt;span&gt;| 3M    | 0        |    |      |            |
&lt;&#x2F;span&gt;&lt;span&gt;+-------+----------+    +------+------------+
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;My final solution completes in &lt;code&gt;511ms&lt;&#x2F;code&gt;. Quite the achievement, as it seems
rather fast compared to &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;adventofcode&#x2F;comments&#x2F;kdf85p&#x2F;2020_day_15_solutions&#x2F;&quot;&gt;others&lt;&#x2F;a&gt;. This is the most costly puzzle
when looking at runtime. It alone takes up 73% of my total runtime and consumes
more than half of my 1-second target. &lt;em&gt;Ouch...&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;day-17-conway-cubes&quot;&gt;Day 17: Conway Cubes
    &lt;a class=&quot;anchor&quot; href=&quot;#day-17-conway-cubes&quot; aria-label=&quot;Anchor link for: day-17-conway-cubes&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;For &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;17&quot;&gt;day 17&lt;&#x2F;a&gt; &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Conway%27s_Game_of_Life&quot;&gt;Conway&#x27;s Game of Life&lt;&#x2F;a&gt; returns (who&#x27;d have thought
looking at its title), though it has a special twist. You have to figure out how
many &#x27;cubes&#x27; are active after a number of cycles, but this time we&#x27;re doing it
in 3D space. The puzzle input is a 2D slice that serves as starting state.&lt;&#x2F;p&gt;
&lt;p&gt;The first optimization I implemented was to limit the search space each cycle.
This space starts with the input size and grows by one in each direction for
each iteration. This limits the number of cubes to check, as distant cubes can&#x27;t
be active yet. Easy.&lt;&#x2F;p&gt;
&lt;p&gt;Because the initial state is a 2D slice, I noticed another interesting property.
As the 2D slice is effectively the same on the two &lt;em&gt;sides&lt;&#x2F;em&gt; of the third axis, it
expands with the same pattern in both directions. This means that the third axis
is mirrored from the center (the slice). I only have to simulate one of these
two sides and multiply the cube count to get the answer we need. This halves
the number of operations reducing runtime.&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#191919;color:#f8f8f2;&quot;&gt;&lt;code&gt;&lt;span&gt;2D example with 1D (column) input which mirrors:
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;       single input column
&lt;&#x2F;span&gt;&lt;span&gt;       |
&lt;&#x2F;span&gt;&lt;span&gt;---------------
&lt;&#x2F;span&gt;&lt;span&gt;#---##---##---#
&lt;&#x2F;span&gt;&lt;span&gt;#--#--#-#--#--#
&lt;&#x2F;span&gt;&lt;span&gt;---#-#---#-#---
&lt;&#x2F;span&gt;&lt;span&gt;----#-----#----
&lt;&#x2F;span&gt;&lt;span&gt;---------------        what the field
&lt;&#x2F;span&gt;&lt;span&gt;-----#---#-----    &amp;lt;-- looks like after
&lt;&#x2F;span&gt;&lt;span&gt;----##---##----        some cycles
&lt;&#x2F;span&gt;&lt;span&gt;---##-----##---
&lt;&#x2F;span&gt;&lt;span&gt;---------------
&lt;&#x2F;span&gt;&lt;span&gt;-----#####-----
&lt;&#x2F;span&gt;&lt;span&gt;------###------
&lt;&#x2F;span&gt;&lt;span&gt;------###------
&lt;&#x2F;span&gt;&lt;span&gt;       |
&lt;&#x2F;span&gt;&lt;span&gt;   &amp;lt;&amp;lt;&amp;lt; | &amp;gt;&amp;gt;&amp;gt;
&lt;&#x2F;span&gt;&lt;span&gt;       |
&lt;&#x2F;span&gt;&lt;span&gt;       mirrors left and right
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;17#part2&quot;&gt;Part 2&lt;&#x2F;a&gt; gets even better. The puzzle is similar but simulates in 4D
space. To accommodate for this the rules have changed slightly, but the input is
still the same 2D slice. This is fantastic because this means not just one but
two axis are mirrored now. With the same optimization, I now need to simulate
only ¼th of the space, making the solution 4 times quicker!&lt;&#x2F;p&gt;
&lt;!-- TODO: day 19 may be fun as well --&gt;
&lt;h2 id=&quot;day-20-jurassic-jigsaw&quot;&gt;Day 20: Jurassic Jigsaw
    &lt;a class=&quot;anchor&quot; href=&quot;#day-20-jurassic-jigsaw&quot; aria-label=&quot;Anchor link for: day-20-jurassic-jigsaw&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;20&quot;&gt;Day 20&lt;&#x2F;a&gt; involves a jigsaw puzzle. Each piece is a 10×10 matrix of bits.
All pieces form a larger square. The bits on the edges between two pieces must
align. Every piece can be placed anywhere and may need to be rotated or flipped
in any direction. That&#x27;s a lot of combinations.&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#191919;color:#f8f8f2;&quot;&gt;&lt;code&gt;&lt;span&gt;Placed tiles for small example puzzle:
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;T3:    T9:    T2:
&lt;&#x2F;span&gt;&lt;span&gt;..##.  ...##  #.##.
&lt;&#x2F;span&gt;&lt;span&gt;##..#  #...#  #.###
&lt;&#x2F;span&gt;&lt;span&gt;#...#  #..#.  .....
&lt;&#x2F;span&gt;&lt;span&gt;####.  ....#  #...#
&lt;&#x2F;span&gt;&lt;span&gt;##.##  #####  ###.#
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;T1:    T6:    T5:
&lt;&#x2F;span&gt;&lt;span&gt;##.##  #####  ###.#
&lt;&#x2F;span&gt;&lt;span&gt;.#.##  #..##  ###.#
&lt;&#x2F;span&gt;&lt;span&gt;..#..  ..#..  .###.
&lt;&#x2F;span&gt;&lt;span&gt;###..  .#.#.  ..#.#
&lt;&#x2F;span&gt;&lt;span&gt;..##.  ..###  #...#
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;T7:    T4:    T8:
&lt;&#x2F;span&gt;&lt;span&gt;..##.  ..###  #...#
&lt;&#x2F;span&gt;&lt;span&gt;#..#.  .#..#  #..##
&lt;&#x2F;span&gt;&lt;span&gt;##.#.  .#.#.  .#.#.
&lt;&#x2F;span&gt;&lt;span&gt;.####  ####.  .###.
&lt;&#x2F;span&gt;&lt;span&gt;..##.  .####  #.###
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To solve the first part you must figure out what pieces are placed in the 4
corners. &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;kevinhill.nl&#x2F;&quot;&gt;@gkhill&lt;&#x2F;a&gt; gave me the insight (thanks for that!)
that corner pieces have two edges that don&#x27;t connect to anything and likely
won&#x27;t match any other edge. Now I only had to find 4 pieces with edges that
didn&#x27;t match any other edge. In the example above the tiles, T3, T2, T7, and T8
all have 2 edges that don&#x27;t match any other. Rather simple. That worked.&lt;&#x2F;p&gt;
&lt;p&gt;In &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;20#part2&quot;&gt;part 2&lt;&#x2F;a&gt; I use tricks like just rotating&#x2F;flipping tile edges
instead of the full tile body while positioning them. I won&#x27;t go into further
detail because it doesn&#x27;t seem to affect the total runtime too much. But you
might find the &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;day20b&#x2F;src&#x2F;main.rs&quot;&gt;implementation&lt;&#x2F;a&gt; interesting.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;day-23-crab-cups&quot;&gt;Day 23: Crab Cups
    &lt;a class=&quot;anchor&quot; href=&quot;#day-23-crab-cups&quot; aria-label=&quot;Anchor link for: day-23-crab-cups&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;23&quot;&gt;Day 23&lt;&#x2F;a&gt; involves a game of moving cups. The cups are arranged in a
circle. Each is labeled with a unique number. To solve the puzzle you have to
move chunks of them around based on a set of rules for a specific number of
turns, to get a final sequence.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;23#part2&quot;&gt;Part 2&lt;&#x2F;a&gt; gives you one million cups, for which you&#x27;ve to do ten million
moves. That&#x27;s a lot! Representing the cups as a list of numbers in an array
turns out to be very inefficiënt. For each iteration, you&#x27;d have to move a chunk
of cups through the list. This requires shifting a lot of items in memory,
resulting in many reallocations. That&#x27;s slow, no good!&lt;&#x2F;p&gt;
&lt;p&gt;Instead, I choose to &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;day23b&#x2F;src&#x2F;main.rs#L10-L18&quot;&gt;utilize&lt;&#x2F;a&gt; a structure that essentially
functions like a &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Linked_list&quot;&gt;linked list&lt;&#x2F;a&gt;. I allocated an array with one item
for each cup. The array is indexed by cup number. For each cup, it holds the
number of the next cup. It effectively points to the following cup in the
arrangement, looping the sequence.&lt;&#x2F;p&gt;
&lt;p&gt;This is great because it makes moving a chunk of cups around super cheap.
Instead of having to shift a lot of items through memory, you just have to
&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;day23b&#x2F;src&#x2F;main.rs#L37-L39&quot;&gt;update&lt;&#x2F;a&gt; 3 pointers. To move a chunk of cups, I:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;update the cup before the old chunk position, to point to the cup after the old chunk position,&lt;&#x2F;li&gt;
&lt;li&gt;update the cup before the new chunk position, to point to the first cup of the chunk,&lt;&#x2F;li&gt;
&lt;li&gt;update the last cup of the chunk, to point to the cup after the new chunk position.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre style=&quot;background-color:#191919;color:#f8f8f2;&quot;&gt;&lt;code&gt;&lt;span&gt;Cup sequence: 3  8  9  1  2  5  4  6  7
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;Linked list, storing our sequence:
&lt;&#x2F;span&gt;&lt;span&gt;+---+---+---+---+---+---+---+---+---+
&lt;&#x2F;span&gt;&lt;span&gt;| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | &amp;lt;- cup label
&lt;&#x2F;span&gt;&lt;span&gt;+---+---+---+---+---+---+---+---+---+
&lt;&#x2F;span&gt;&lt;span&gt;| 2 | 5 | 8 | 6 | 4 | 7 | 3 | 9 | 1 | &amp;lt;- points to (next cup)
&lt;&#x2F;span&gt;&lt;span&gt;+---+---+---+---+---+---+---+---+---+
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;To move chunk [8, 9, 1] after 5:
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;Cup sequence: 3 |8  9  1| 2  5  4  6  7
&lt;&#x2F;span&gt;&lt;span&gt;                +-------+
&lt;&#x2F;span&gt;&lt;span&gt;                       v
&lt;&#x2F;span&gt;&lt;span&gt;                      +-------+
&lt;&#x2F;span&gt;&lt;span&gt;Cup sequence: 3  2  5 |8  9  1| 4  6  7
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;          +---------- 1. change 3 to point to 2
&lt;&#x2F;span&gt;&lt;span&gt;          |       +-- 2. change 5 to point to 8
&lt;&#x2F;span&gt;&lt;span&gt;  +-------|-------|-- 3. change 1 to point to 4
&lt;&#x2F;span&gt;&lt;span&gt;  |       |       |
&lt;&#x2F;span&gt;&lt;span&gt;  |       |       |
&lt;&#x2F;span&gt;&lt;span&gt;  v       v       v
&lt;&#x2F;span&gt;&lt;span&gt;+---+---+---+---+---+---+---+---+---+
&lt;&#x2F;span&gt;&lt;span&gt;| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | &amp;lt;- cup label
&lt;&#x2F;span&gt;&lt;span&gt;+---+---+---+---+---+---+---+---+---+
&lt;&#x2F;span&gt;&lt;span&gt;| 4 | 5 | 2 | 6 | 8 | 7 | 3 | 9 | 1 | &amp;lt;- points to (next cup)
&lt;&#x2F;span&gt;&lt;span&gt;+---+---+---+---+---+---+---+---+---+
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As a bonus; you can instantly find a cup with a specified number by its index.
And because the last cup can point to the first an edge case is removed for
handling the sequence as a loop. Brilliant!&lt;&#x2F;p&gt;
&lt;p&gt;The final implementation runs &lt;code&gt;192ms&lt;&#x2F;code&gt;, making it the second slowest solution.
The optimizations are useful here to keep everything under one second.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;day-24-lobby-layout&quot;&gt;Day 24: Lobby Layout
    &lt;a class=&quot;anchor&quot; href=&quot;#day-24-lobby-layout&quot; aria-label=&quot;Anchor link for: day-24-lobby-layout&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;24&quot;&gt;Day 24&lt;&#x2F;a&gt; involves a floor of hexagonal tiles. You&#x27;re given a list of
directions to move on it, the target tile must be flipped between black and
white.&lt;&#x2F;p&gt;
&lt;p&gt;A hexagonal grid can be tricky to comprehend. I just &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;day24a&#x2F;src&#x2F;main.rs#L11-L17&quot;&gt;work&lt;&#x2F;a&gt; with it
as if it&#x27;s a &lt;em&gt;square (but askew)&lt;&#x2F;em&gt; grid. Seeing a problem like this differently
can greatly reduce its complexity.&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#191919;color:#f8f8f2;&quot;&gt;&lt;code&gt;&lt;span&gt;         _____         _____         _____
&lt;&#x2F;span&gt;&lt;span&gt;        &#x2F;     \       &#x2F;     \       &#x2F;     \
&lt;&#x2F;span&gt;&lt;span&gt;  _____&#x2F; -2,-1 \_____&#x2F;  0,-1 \_____&#x2F;  2,-1 \_____
&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;     \       &#x2F;     \       &#x2F;     \       &#x2F;     \
&lt;&#x2F;span&gt;&lt;span&gt;&#x2F; -3,-1 \_____&#x2F; -1,-1 \_____&#x2F;  1,-1 \_____&#x2F;  3,-1 \
&lt;&#x2F;span&gt;&lt;span&gt;\       &#x2F;     \       &#x2F;     \       &#x2F;     \       &#x2F;
&lt;&#x2F;span&gt;&lt;span&gt; \_____&#x2F; -2,0  \_____&#x2F;  0,0  \_____&#x2F;  2,0  \_____&#x2F;
&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;     \       &#x2F;     \       &#x2F;     \       &#x2F;     \
&lt;&#x2F;span&gt;&lt;span&gt;&#x2F; -3,0  \_____&#x2F; -1,0  \_____&#x2F;  1,0  \_____&#x2F;  3,0  \
&lt;&#x2F;span&gt;&lt;span&gt;\       &#x2F;     \       &#x2F;     \       &#x2F;     \       &#x2F;
&lt;&#x2F;span&gt;&lt;span&gt; \_____&#x2F; -2,1  \_____&#x2F;  0,1  \_____&#x2F;  2,1  \_____&#x2F;
&lt;&#x2F;span&gt;&lt;span&gt; &#x2F;     \       &#x2F;     \       &#x2F;     \       &#x2F;     \
&lt;&#x2F;span&gt;&lt;span&gt;&#x2F; -3,1  \_____&#x2F; -1,1  \_____&#x2F;  1,1  \_____&#x2F;  3,1  \
&lt;&#x2F;span&gt;&lt;span&gt;\       &#x2F;     \       &#x2F;     \       &#x2F;     \       &#x2F;
&lt;&#x2F;span&gt;&lt;span&gt; \_____&#x2F;       \_____&#x2F;       \_____&#x2F;       \_____&#x2F;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;24#part2&quot;&gt;Part 2&lt;&#x2F;a&gt; challenges us to a &lt;em&gt;Game of Life&lt;&#x2F;em&gt; one last time. This time we&#x27;re
using the hexagonal grid, however, ouch. The floor from part 1 is our starting
state. A set of rules is provided to flip tiles between black and white based on
their neighboring tiles.&lt;&#x2F;p&gt;
&lt;p&gt;I kept the square grid from part 1. Though each square tile has 6 neighbors
(including 2 diagonal) instead of just 4 to match what a real hexagonal grid
would be like. Based on the rules we only have to consider tiles that have at
least one neighboring black tile. This makes processing the infinitely sized
floor cheaper.&lt;&#x2F;p&gt;
&lt;p&gt;I &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;day24b&#x2F;src&#x2F;main.rs#L30-L45&quot;&gt;compile&lt;&#x2F;a&gt; a list of all neighbor tiles for each black tile and
count their occurrence number. After collecting this list I loop over all these
neighbors with their occurrence count to process the rules accordingly. Using
this method I skip looping over a huge amount of useless tiles and asserting the
rules becomes simple, similar to what I&#x27;ve done on &lt;a href=&quot;https:&#x2F;&#x2F;timvisee.com&#x2F;blog&#x2F;solving-aoc-2020-in-under-a-second&#x2F;#day-11-seating-system&quot;&gt;day
13&lt;&#x2F;a&gt;. Doing just 100 iterations as the puzzle specifies
takes &lt;code&gt;43.2ms&lt;&#x2F;code&gt;, pretty expensive I think. With &lt;code&gt;656ms&lt;&#x2F;code&gt; total runtime so far I&#x27;m
still well under my 1-second target though.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;day-25-combo-breaker&quot;&gt;Day 25: Combo Breaker
    &lt;a class=&quot;anchor&quot; href=&quot;#day-25-combo-breaker&quot; aria-label=&quot;Anchor link for: day-25-combo-breaker&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;On &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;2020&#x2F;day&#x2F;25&quot;&gt;day 25&lt;&#x2F;a&gt; you&#x27;re challenged to obtain the encryption key to break a
card-based door locking system. A set of cryptography rules is given, along with
the public key of the card and the door lock, and some additional parameters.&lt;&#x2F;p&gt;
&lt;p&gt;You have to brute force your way to the final encryption key which you must
obtain. After understanding the cryptography rules it becomes clear that you&#x27;ve
to run some multiplication &amp;amp; modulo calculations for an unknown number of cycles
to obtain the final key. The number of cycles will likely be very large, so
cracking this lock will take some time.&lt;&#x2F;p&gt;
&lt;p&gt;As part of the puzzle two public keys are given each having its own (unknown)
number of cycles and parameters. This means that there are two paths to brute
force the key, one of which being shorter. I want to be as quick as possible to
keep runtime low, but it is unknown which path is faster.&lt;&#x2F;p&gt;
&lt;p&gt;I, therefore, choose to &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;day25a&#x2F;src&#x2F;main.rs#L8-L21&quot;&gt;crack&lt;&#x2F;a&gt; both keys at the same time. The
process will be complete as soon as the key is found for either of the two,
using the shortest possible number of cycles. As the calculations on both keys
are so similar the compiler &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Automatic_vectorization&quot;&gt;vectorized&lt;&#x2F;a&gt; it in a single
operation, basically making it as quick as cracking a single key. It
took 8419518 cycles to crack this lock, running &lt;code&gt;27.9ms&lt;&#x2F;code&gt;. Awesome.&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;h2 id=&quot;results&quot;&gt;Results
    &lt;a class=&quot;anchor&quot; href=&quot;#results&quot; aria-label=&quot;Anchor link for: results&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;That&#x27;s it. I solved all puzzles!&lt;&#x2F;p&gt;
&lt;p&gt;Now it was time to measure the total runtime.
I&#x27;ve set up a simple &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;runner&#x2F;src&#x2F;bin&#x2F;runner.rs#L5&quot;&gt;runner&lt;&#x2F;a&gt; for this to run and measure &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;runner&#x2F;src&#x2F;lib.rs&quot;&gt;all&lt;&#x2F;a&gt; my
solutions in sequence.&lt;&#x2F;p&gt;
&lt;p&gt;My final solutions complete in just &lt;code&gt;699ms&lt;&#x2F;code&gt;! That&#x27;s from day 1 to day 25, 49
solutions in total, one after the other (!). Well under my 1-second
target. A fantastic achievement! Time to buy a cake.&lt;&#x2F;p&gt;
&lt;pre style=&quot;background-color:#191919;color:#f8f8f2;&quot;&gt;&lt;code&gt;&lt;span&gt;             ___________
&lt;&#x2F;span&gt;&lt;span&gt;            &amp;#39;._==_==_=_.&amp;#39;
&lt;&#x2F;span&gt;&lt;span&gt;            .-\:      &#x2F;-.
&lt;&#x2F;span&gt;&lt;span&gt;           | (|:.     |) |
&lt;&#x2F;span&gt;&lt;span&gt;            &amp;#39;-|:.     |-&amp;#39;
&lt;&#x2F;span&gt;&lt;span&gt;              \::.    &#x2F;
&lt;&#x2F;span&gt;&lt;span&gt;               &amp;#39;::. .&amp;#39;
&lt;&#x2F;span&gt;&lt;span&gt;                 ) (
&lt;&#x2F;span&gt;&lt;span&gt;               _.&amp;#39; &amp;#39;._
&lt;&#x2F;span&gt;&lt;span&gt;              `&amp;quot;&amp;quot;&amp;quot;&amp;quot;&amp;quot;&amp;quot;&amp;quot;`
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here&#x27;s a chart with all results plotted (&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020#timings&quot;&gt;details&lt;&#x2F;a&gt;):&lt;&#x2F;p&gt;
&lt;p&gt;
    &lt;a href=&quot;graph.png&quot; title=&quot;View full-size image&quot;&gt;
        
        
        
        &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;timvisee.com&amp;#x2F;processed_images&amp;#x2F;5117b53b929ef29d00.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
&lt;&#x2F;p&gt;
&lt;p&gt;Out of interest I also ran all solutions in &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;runner&#x2F;src&#x2F;bin&#x2F;runner-par.rs#L14&quot;&gt;parallel&lt;&#x2F;a&gt; on my
somewhat old 4-core Intel i5 CPU, which completes everything in a whopping
&lt;code&gt;511ms&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;additional-tricks&quot;&gt;Additional tricks
    &lt;a class=&quot;anchor&quot; href=&quot;#additional-tricks&quot; aria-label=&quot;Anchor link for: additional-tricks&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;I did use other cool things to improve performance with which I didn&#x27;t mention
anywhere else. Here are some of them, most are Rust specific:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;std&#x2F;macro.include_bytes.html&quot;&gt;&lt;code&gt;include_bytes!&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; &amp;amp; &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;std&#x2F;macro.include_str.html&quot;&gt;&lt;code&gt;include_str!&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;: &lt;em&gt;instead of
reading puzzle input from a file at runtime, I embedded the file statically in
the solution binary itself using these Rust macros. This removes file read
operations, while still having a puzzle input file, shaving off some time.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;reference&#x2F;attributes&#x2F;codegen.html#the-inline-attribute&quot;&gt;&lt;code&gt;#[inline]&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;: &lt;em&gt;I suggested the compiler to inline some functions, to
limit time spent by calling functions a billion times, shaving off some time.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Geal&#x2F;nom&quot;&gt;&lt;code&gt;nom&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;: &lt;em&gt;an awesome Rust crate for building efficient binary parsers,
&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;day18a&#x2F;src&#x2F;main.rs#L15-L32&quot;&gt;used&lt;&#x2F;a&gt; this in &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;day02b&#x2F;src&#x2F;main.rs#L16-L35&quot;&gt;various&lt;&#x2F;a&gt; places to parse tricky
formats faster and more robustly than regexes or manual splitting.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;day23b&#x2F;.cargo&#x2F;config&quot;&gt;Custom&lt;&#x2F;a&gt; build flags and native optimization: &lt;em&gt;for some
solutions, I tweaked link-time optimization, disabled compile-time
concurrency, and compiled with optimizations for my specific CPU model to
shave of some time.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Increased stack size limit: &lt;em&gt;for &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&#x2F;blob&#x2F;b8c6e75e3844714fe8fa229afa618941bd219e79&#x2F;day15b&#x2F;src&#x2F;main.rs#L15&quot;&gt;day 15 part 2&lt;&#x2F;a&gt; I
increased the maximum stack size with &lt;code&gt;ulimit -s unlimited&lt;&#x2F;code&gt; to fit more
than 8192 kilobytes on the stack frame to make the overall solution more
efficient.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;See the &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;advent-of-code-2020&quot;&gt;source code&lt;&#x2F;a&gt; for more interesting stuff.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;closing-words&quot;&gt;Closing words
    &lt;a class=&quot;anchor&quot; href=&quot;#closing-words&quot; aria-label=&quot;Anchor link for: closing-words&quot;&gt;&lt;&#x2F;a&gt;

&lt;&#x2F;h2&gt;
&lt;p&gt;Some have probably come up with some faster solutions than me. When I compare my
solutions with others in the Advent of Code &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;adventofcode&#x2F;wiki&#x2F;solution_megathreads#wiki_december_2020&quot;&gt;megathread&lt;&#x2F;a&gt; on
Reddit, I seem to have done very well though.&lt;&#x2F;p&gt;
&lt;p&gt;Setting this goal made this year&#x27;s Advent of Code very interesting to me. It
constantly required me to think about what the most efficient approach could be.
This makes you creative, making your code quite elegant in many cases. If you&#x27;re
looking for a challenge, I recommend you to do the same. Please consider to
share your cool implementations as well.&lt;&#x2F;p&gt;
&lt;p&gt;Thanks for reading folks. I hope you&#x27;ve gained new insight on programming
challenges and have learned a thing or two. I&#x27;ll see you on the 1st of December
for the next &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;adventofcode.com&#x2F;&quot;&gt;Advent of Code&lt;&#x2F;a&gt;!&lt;&#x2F;p&gt;
</description>
            </item>
        
            <item>
                <title>Ray Tracer in Rust</title>
                <pubDate>Tue, 17 Sep 2019 00:00:00 +0000</pubDate>
                <link>https://timvisee.com/projects/raytrace-rs/</link>
                <guid>https://timvisee.com/projects/raytrace-rs/</guid>
                <description>&lt;p&gt;A ray tracer in Rust.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;raytrace-rs&quot;&gt;Visit project page on GitHub&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;p&gt;
    &lt;a href=&quot;balls.png&quot; title=&quot;View full-size image&quot;&gt;
        
        
        
        &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;timvisee.com&amp;#x2F;processed_images&amp;#x2F;bb04b2932f8690a500.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
&lt;&#x2F;p&gt;

&lt;p&gt;
    &lt;a href=&quot;glass.png&quot; title=&quot;View full-size image&quot;&gt;
        
        
        
        &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;timvisee.com&amp;#x2F;processed_images&amp;#x2F;9a7ebba1f6a4e16900.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
&lt;&#x2F;p&gt;

&lt;p&gt;
    &lt;a href=&quot;dragon.png&quot; title=&quot;View full-size image&quot;&gt;
        
        
        
        &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;timvisee.com&amp;#x2F;processed_images&amp;#x2F;9b91c3ea1ebc081200.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
&lt;&#x2F;p&gt;
&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;raytrace-rs&#x2F;#readme&quot;&gt;Examples&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;raytrace-rs&#x2F;#usage&quot;&gt;Usage&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;View more on the project pages over at:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;raytrace-rs&quot;&gt;GitHub&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;gitlab.com&#x2F;timvisee&#x2F;raytrace-rs&quot;&gt;GitLab&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</description>
            </item>
        
            <item>
                <title>qr2term</title>
                <pubDate>Thu, 14 Mar 2019 00:00:00 +0000</pubDate>
                <link>https://timvisee.com/projects/qr2term/</link>
                <guid>https://timvisee.com/projects/qr2term/</guid>
                <description>&lt;p&gt;A stupidly simple QR code renderer, that prints text as QR code to the terminal, and nothing else.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;qr2term-rs&quot;&gt;Visit project page on GitHub&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;View more on the project pages over at:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;qr2term-rs&quot;&gt;GitHub&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;gitlab.com&#x2F;timvisee&#x2F;qr2term-rs&quot;&gt;GitLab&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</description>
            </item>
        
            <item>
                <title>ffsend-api</title>
                <pubDate>Mon, 21 May 2018 00:00:00 +0000</pubDate>
                <link>https://timvisee.com/projects/ffsend-api/</link>
                <guid>https://timvisee.com/projects/ffsend-api/</guid>
                <description>&lt;blockquote&gt;
&lt;p&gt;A fully featured Firefox Send API client written in Rust.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;ffsend-api&quot;&gt;Visit project page on GitHub&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;asciinema.org&#x2F;a&#x2F;182225&quot;&gt;&lt;img src=&quot;https:&#x2F;&#x2F;cdn.rawgit.com&#x2F;timvisee&#x2F;ffsend&#x2F;6e8ef55b&#x2F;res&#x2F;demo.svg&quot; alt=&quot;ffsend usage demo&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;em&gt;No demo visible here? View it on &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;asciinema.org&#x2F;a&#x2F;182225&quot;&gt;asciinema&lt;&#x2F;a&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;View more on the project pages over at:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;ffsend-api&quot;&gt;GitHub&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;gitlab.com&#x2F;timvisee&#x2F;ffsend-api&quot;&gt;GitLab&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Also see these related projects:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;timvisee.com&#x2F;projects&#x2F;send&#x2F;&quot;&gt;Send&lt;&#x2F;a&gt; &lt;span class=&quot;muted&quot;&gt;(Send project)&lt;&#x2F;span&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;timvisee.com&#x2F;projects&#x2F;ffsend&#x2F;&quot;&gt;&lt;code&gt;ffsend&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; &lt;span class=&quot;muted&quot;&gt;(CLI client implementation)&lt;&#x2F;span&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</description>
            </item>
        
            <item>
                <title>ffsend</title>
                <pubDate>Mon, 21 May 2018 00:00:00 +0000</pubDate>
                <link>https://timvisee.com/projects/ffsend/</link>
                <guid>https://timvisee.com/projects/ffsend/</guid>
                <description>&lt;blockquote&gt;
&lt;p&gt;Easily and securely share files from the command line.
A fully featured Firefox Send client.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;ffsend&quot;&gt;Visit project page on GitHub&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Easily and securely share files and directories from the command line through
a safe, private and encrypted link using a single simple command. Files are
shared using the Send service and may be up to 1GB (2.5GB authenticated).
Others are able to download these files with this tool, or through their web
browser.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;asciinema.org&#x2F;a&#x2F;182225&quot;&gt;&lt;img src=&quot;https:&#x2F;&#x2F;cdn.rawgit.com&#x2F;timvisee&#x2F;ffsend&#x2F;6e8ef55b&#x2F;res&#x2F;demo.svg&quot; alt=&quot;ffsend usage demo&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;br &#x2F;&gt;
&lt;small&gt;&lt;em&gt;No demo visible here? View it on &lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;asciinema.org&#x2F;a&#x2F;182225&quot;&gt;asciinema&lt;&#x2F;a&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;p&gt;All files are always encrypted on the client, and secrets are never shared with the remote host. An optional password may be specified, and a default file lifetime of 1 (up to 20) download or 24 hours is enforced to ensure your stuff does not remain online forever. This provides a secure platform to share your files. Find out more about security here.&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;ffsend&#x2F;#features&quot;&gt;Features&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;ffsend&#x2F;#usage&quot;&gt;Usage&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;ffsend&#x2F;#requirements&quot;&gt;Requirements&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;ffsend&#x2F;#install&quot;&gt;Install&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;ffsend&#x2F;#build&quot;&gt;Build&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;ffsend&#x2F;#security&quot;&gt;Security&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;View more on the project pages over at:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;ffsend&quot;&gt;GitHub&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;gitlab.com&#x2F;timvisee&#x2F;ffsend&quot;&gt;GitLab&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Also see these related projects:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;timvisee.com&#x2F;projects&#x2F;send&#x2F;&quot;&gt;Send&lt;&#x2F;a&gt; &lt;span class=&quot;muted&quot;&gt;(Send project)&lt;&#x2F;span&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;timvisee.com&#x2F;projects&#x2F;ffsend-api&#x2F;&quot;&gt;&lt;code&gt;ffsend-api&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; &lt;span class=&quot;muted&quot;&gt;(Send library implementation for Rust)&lt;&#x2F;span&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</description>
            </item>
        
            <item>
                <title>pixelpwnr-server</title>
                <pubDate>Fri, 29 Dec 2017 00:00:00 +0000</pubDate>
                <link>https://timvisee.com/projects/pixelpwnr-server/</link>
                <guid>https://timvisee.com/projects/pixelpwnr-server/</guid>
                <description>&lt;blockquote&gt;
&lt;p&gt;Blazingly fast GPU accelerated pixelflut server written in Rust.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;pixelpwnr-server&quot;&gt;Visit project page on GitHub&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;hr &#x2F;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;pixelpwnr-server&#x2F;#features&quot;&gt;Features&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;pixelpwnr-server&#x2F;#installation&quot;&gt;Installation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;View more on the project pages over at:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;pixelpwnr-server&quot;&gt;GitHub&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;gitlab.com&#x2F;timvisee&#x2F;pixelpwnr-server&quot;&gt;GitLab&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Also see these related projects:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;timvisee.com&#x2F;projects&#x2F;pixelpwnr&#x2F;&quot;&gt;&lt;code&gt;pixelpwnr&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; &lt;span class=&quot;muted&quot;&gt;(pixelflut client)&lt;&#x2F;span&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</description>
            </item>
        
            <item>
                <title>pixelpwnr</title>
                <pubDate>Fri, 29 Dec 2017 00:00:00 +0000</pubDate>
                <link>https://timvisee.com/projects/pixelpwnr/</link>
                <guid>https://timvisee.com/projects/pixelpwnr/</guid>
                <description>&lt;blockquote&gt;
&lt;p&gt;Insanely fast pixelflut client for images and animations written in Rust.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;pixelpwnr&quot;&gt;Visit project page on GitHub&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;hr &#x2F;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;pixelpwnr&#x2F;#features&quot;&gt;Features&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;pixelpwnr&#x2F;#usage&quot;&gt;Usage&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;pixelpwnr&#x2F;#installation&quot;&gt;Installation&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;View more on the project pages over at:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;pixelpwnr&quot;&gt;GitHub&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;gitlab.com&#x2F;timvisee&#x2F;pixelpwnr&quot;&gt;GitLab&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Also see these related projects:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;timvisee.com&#x2F;projects&#x2F;pixelpwnr-server&#x2F;&quot;&gt;&lt;code&gt;pixelpwnr-server&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; &lt;span class=&quot;muted&quot;&gt;(pixelflut server)&lt;&#x2F;span&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</description>
            </item>
        
            <item>
                <title>Pokoebox</title>
                <pubDate>Tue, 14 Mar 2017 00:00:00 +0000</pubDate>
                <link>https://timvisee.com/projects/pokoebox/</link>
                <guid>https://timvisee.com/projects/pokoebox/</guid>
                <description>&lt;p&gt;A smart portable boombox project featuring a built-in touch screen with custom
media center.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;pokoebox&quot;&gt;Visit project page on GitHub&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;View more on the project pages over at:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;pokoebox&quot;&gt;GitHub&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;gitlab.com&#x2F;timvisee&#x2F;pokoebox&quot;&gt;GitLab&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</description>
            </item>
        
            <item>
                <title>version-compare</title>
                <pubDate>Mon, 13 Mar 2017 00:00:00 +0000</pubDate>
                <link>https://timvisee.com/projects/version-compare/</link>
                <guid>https://timvisee.com/projects/version-compare/</guid>
                <description>&lt;p&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;crates.io&#x2F;crates&#x2F;version-compare&quot;&gt;&lt;img src=&quot;https:&#x2F;&#x2F;img.shields.io&#x2F;crates&#x2F;d&#x2F;version-compare.svg&quot; alt=&quot;Download statistics&quot; &#x2F;&gt;&lt;&#x2F;a&gt;
&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;crates.io&#x2F;crates&#x2F;version-compare&quot;&gt;&lt;img src=&quot;https:&#x2F;&#x2F;img.shields.io&#x2F;crates&#x2F;v&#x2F;version-compare.svg&quot; alt=&quot;Crate version&quot; &#x2F;&gt;&lt;&#x2F;a&gt;
&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;docs.rs&#x2F;version-compare&quot;&gt;&lt;img src=&quot;https:&#x2F;&#x2F;docs.rs&#x2F;version-compare&#x2F;badge.svg&quot; alt=&quot;Documentation&quot; &#x2F;&gt;&lt;&#x2F;a&gt;
&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;gitlab.com&#x2F;timvisee&#x2F;version-compare&#x2F;pipelines&quot;&gt;&lt;img src=&quot;https:&#x2F;&#x2F;gitlab.com&#x2F;timvisee&#x2F;version-compare&#x2F;badges&#x2F;master&#x2F;pipeline.svg&quot; alt=&quot;Build status on GitLab CI&quot; &#x2F;&gt;&lt;&#x2F;a&gt;
&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;crates.io&#x2F;crates&#x2F;version-compare&quot;&gt;&lt;img src=&quot;https:&#x2F;&#x2F;img.shields.io&#x2F;crates&#x2F;l&#x2F;version-compare.svg&quot; alt=&quot;License&quot; &#x2F;&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Rust library to easily compare version numbers with no specific format, and
test against various comparison operators.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;version-compare&quot;&gt;Visit project page on GitHub&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Comparing version numbers is hard, especially with weird version number formats.&lt;&#x2F;p&gt;
&lt;p&gt;This library helps you to easily compare any kind of version number with no
specific format using a best-effort approach.
Two version numbers can be compared to each other to get a comparison operator
(&lt;code&gt;&amp;lt;&lt;&#x2F;code&gt;, &lt;code&gt;==&lt;&#x2F;code&gt;, &lt;code&gt;&amp;gt;&lt;&#x2F;code&gt;), or test them against a comparison operator.&lt;&#x2F;p&gt;
&lt;p&gt;Along with version comparison, the library provides various other tools for
working with version numbers.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;rust&quot; style=&quot;background-color:#191919;color:#f8f8f2;&quot; class=&quot;language-rust &quot;&gt;&lt;code class=&quot;language-rust&quot; data-lang=&quot;rust&quot;&gt;&lt;span style=&quot;color:#ff5e5e;&quot;&gt;use &lt;&#x2F;span&gt;&lt;span&gt;version_compare::{compare, Cmp};
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span style=&quot;font-style:italic;color:#fbdfb5;&quot;&gt;fn &lt;&#x2F;span&gt;&lt;span style=&quot;color:#8cdaff;&quot;&gt;main&lt;&#x2F;span&gt;&lt;span&gt;() {
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;font-style:italic;color:#fbdfb5;&quot;&gt;let&lt;&#x2F;span&gt;&lt;span&gt; a &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff5e5e;&quot;&gt;= &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ffffff;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#fbe3bf;&quot;&gt;1.3&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ffffff;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;font-style:italic;color:#fbdfb5;&quot;&gt;let&lt;&#x2F;span&gt;&lt;span&gt; b &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff5e5e;&quot;&gt;= &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ffffff;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#fbe3bf;&quot;&gt;1.2.4&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ffffff;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff5e5e;&quot;&gt;match &lt;&#x2F;span&gt;&lt;span style=&quot;color:#6699cc;&quot;&gt;compare&lt;&#x2F;span&gt;&lt;span&gt;(a, b) {
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#fbe3bf;&quot;&gt;Ok&lt;&#x2F;span&gt;&lt;span&gt;(Cmp::Lt) &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff5e5e;&quot;&gt;=&amp;gt; &lt;&#x2F;span&gt;&lt;span&gt;println!(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ffffff;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#fbe3bf;&quot;&gt;Version a is less than b&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ffffff;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;),
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#fbe3bf;&quot;&gt;Ok&lt;&#x2F;span&gt;&lt;span&gt;(Cmp::Eq) &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff5e5e;&quot;&gt;=&amp;gt; &lt;&#x2F;span&gt;&lt;span&gt;println!(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ffffff;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#fbe3bf;&quot;&gt;Version a is equal to b&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ffffff;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;),
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#fbe3bf;&quot;&gt;Ok&lt;&#x2F;span&gt;&lt;span&gt;(Cmp::Gt) &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff5e5e;&quot;&gt;=&amp;gt; &lt;&#x2F;span&gt;&lt;span&gt;println!(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ffffff;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#fbe3bf;&quot;&gt;Version a is greater than b&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ffffff;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;),
&lt;&#x2F;span&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff5e5e;&quot;&gt;_ =&amp;gt; &lt;&#x2F;span&gt;&lt;span&gt;panic!(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ffffff;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color:#fbe3bf;&quot;&gt;Invalid version number&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ffffff;&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;),
&lt;&#x2F;span&gt;&lt;span&gt;    }
&lt;&#x2F;span&gt;&lt;span&gt;}
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;hr &#x2F;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;version-compare&#x2F;#features&quot;&gt;Features&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;version-compare&#x2F;#example&quot;&gt;Examples&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;View more on the project pages over at:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;timvisee&#x2F;version-compare&quot;&gt;GitHub&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;noopener&quot; target=&quot;_blank&quot; href=&quot;https:&#x2F;&#x2F;gitlab.com&#x2F;timvisee&#x2F;version-compare&quot;&gt;GitLab&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</description>
            </item>
        
    </channel>
</rss>

