Skip to content

Avoid redundant guard checks when validating dates - #15936

Merged
josevalim merged 1 commit into
elixir-lang:mainfrom
preciz:perf/calendar-valid-date-guarded
Sep 24, 2026
Merged

josevalim merged 1 commit into
elixir-lang:mainfrom
preciz:perf/calendar-valid-date-guarded

Conversation

@preciz

@preciz preciz commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Assisted-by: Antigravity:Gemini-Flash

Avoid redundant guard checks when validating dates.
I haven't included benchmark because it's a small improvement close to noise but it avoids work so the gain is real but minimal.

Call days_in_month_guarded/2 directly in Calendar.ISO.valid_date?/3 to
skip redundant month and year guard checks and avoid intermediate call dispatch.

Call days_in_month_guarded/2 directly in Calendar.ISO.valid_date?/3 to
skip redundant month and year guard checks and avoid intermediate call dispatch.

Assisted-by: Antigravity:Gemini-Flash
@josevalim
josevalim merged commit 2ce476f into elixir-lang:main Sep 24, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants