A faster way to calculate the day-of-the-week
benjoffe.com · 5,787 words · saved by 1 readers
A range of fast modulus techniques that beat compiler output
A range of fast modulus techniques that beat compiler output 17 August 2026 Converting a day-count ("rata-die") to the day-of-the-week (“weekday”) sounds like it should be so trivial, that there's almost nothing to say about it. But, as it turns out, when we look under the hood, this is a surprisingly complex problem. Throughout this article I will present a range of really fast functions to solve this problem, tuned for different use cases (throughput vs latency, different platforms etc.). Each (full range 32-bit algorithm) outperforms existing solutions, and many have a latency of just…
saved by
related reading
- Devlog ⚡ Zig Programming Languageziglang.org
- Nick Winter's Blog | The 120-Hour Workweek - Epic Coding Time-Lapseblog.nickwinter.net
- Numbers Every Programmer Should Know By Yearcolin-scott.github.io
- Branchless Equivalents of Simple Functions | Harder, Better, Faster, Strongerhbfs.wordpress.com
- The radix 2^51 trickchosenplaintext.ca
- Math & Engineeringxn--2-umb.com
- Infographics: Operation Costs in CPU Clock Cycles - 6IT6it.dev
- Factoring RSA-260cognition.com
- Zenbleedlock.cmpxchg8b.com
- GitHub - xoreaxeaxeax/asm-hall-of-shame: Racing to the bottom of CPU performancegithub.com
- VROOM: Accelerating (Almost All) Number-Theoretic Cryptography Using Vectorization and the Residue Number Systemeprint.iacr.org
- Ken Shirriff's blogrighto.com