Skip to content

perf: precompute time unit constants#293

Open
leno23 wants to merge 1 commit into
vercel:mainfrom
leno23:perf/precompute-time-constants-271
Open

perf: precompute time unit constants#293
leno23 wants to merge 1 commit into
vercel:mainfrom
leno23:perf/precompute-time-constants-271

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 26, 2026

Summary

  • Replace runtime multiplication chains with precomputed millisecond literals for m, h, d, w, y, and mo
  • Keeps behavior identical while avoiding repeated arithmetic at module load

Fixes #271

Test plan

  • npm test — 167 passing

Replace runtime multiplication chains with literal millisecond values
for each unit constant.

Fixes vercel#271
@leno23 leno23 force-pushed the perf/precompute-time-constants-271 branch from 2e12d33 to c16fd97 Compare May 26, 2026 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unnecessary math

1 participant