Skip to content

Conversation

@meleu
Copy link
Collaborator

@meleu meleu commented Apr 14, 2025

Currently a validation function runs twice:

  1. for actually validating
  2. only to generate the error message

If validation happens to perform a costly computation, this can be slow and a waste of resources.

This MR makes the validation functions run only once, and then use its output for both validation and error message.

@meleu meleu requested a review from DannyBen April 14, 2025 18:40
DannyBen
DannyBen previously approved these changes Apr 14, 2025
Copy link
Member

@DannyBen DannyBen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I will check it locally tomorrow and merge.
Thanks.

@DannyBen DannyBen added this to the 1.2.12 milestone Apr 14, 2025
@DannyBen DannyBen merged commit a3075a0 into master Apr 15, 2025
8 checks passed
@DannyBen DannyBen deleted the prevent-running-validate-twice branch April 15, 2025 07:30
@DannyBen
Copy link
Member

DannyBen commented May 2, 2025

This is released now in v1.2.12.

meleu added a commit that referenced this pull request Aug 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants