Not

Hacker News!

Beta
Home
Jobs
Q&A
Startups
Trends
Users
Live
AI companion for Hacker News

Not

Hacker News!

Beta
Home
Jobs
Q&A
Startups
Trends
Users
Live
AI companion for Hacker News
  1. Home
  2. /Story
  3. /Show HN: A faster day-count to Y,M,D algorithm – 30-40% speedup
  1. Home
  2. /Story
  3. /Show HN: A faster day-count to Y,M,D algorithm – 30-40% speedup
Nov 24, 2025 at 5:47 PM EST

Show HN: A faster day-count to Y,M,D algorithm – 30-40% speedup

benjoffe
1 points
0 comments

Mood

informative

Sentiment

positive

Category

startup_launch

Key topics

Date-Algorithm

Optimization

Performance-Improvement

Converting that integer to a Year, Month and Day is a fundamental calculation made in almost all programming languages and standard libraries. It runs every time a date is displayed, whether it's in a user interface, log, API etc.

While it is rarely a bottleneck, it is a very frequently run algorithm, and thus has attracted a lot of attention over the years.

In 2021, Cassio Neri and Lorenz Schneider developed the Neri-Schneider algorithm, which was a major breakthrough in this niche area.

Lately, I have been studying this function deeply, and found what I believe may be the last remaining substantial improvements achievable on current hardware. The gains come mainly from counting dates backwards, and from reducing the number of multiplications from 7 to 4.

Adoption will depend on whether library maintainers consider the performance benefit to outweigh the readability. If this is rejected on readability grounds, then in those cases my algorithm outlined in Article 1 (linked in the blog post navigation) is likely to be simpler and faster than what almost all existing libraries are currently doing.

I found this a very interesting challenge to work on, and I believe some of the techniques outlined may be applicable to other areas of optimisation.

Discussion Activity

No activity data yet

We're still syncing comments from Hacker News.

Generating AI Summary...

Analyzing up to 500 comments to identify key contributors and discussion patterns

Discussion (0 comments)

Discussion hasn't started yet.

ID: 46040319Type: storyLast synced: 11/24/2025, 10:48:07 PM

Want the full context?

Jump to the original sources

Read the primary article or dive into the live Hacker News thread when you're ready.

Read ArticleView on HN

Not

Hacker News!

AI-observed conversations & context

Daily AI-observed summaries, trends, and audience signals pulled from Hacker News so you can see the conversation before it hits your feed.

LiveBeta

Explore

  • Home
  • Jobs radar
  • Tech pulse
  • Startups
  • Trends

Resources

  • Visit Hacker News
  • HN API
  • Modal cronjobs
  • Meta Llama

Briefings

Inbox recaps on the loudest debates & under-the-radar launches.

Connect

© 2025 Not Hacker News! — independent Hacker News companion.

Not affiliated with Hacker News or Y Combinator. We simply enrich the public API with analytics.