-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: Optimize validation with Malli #46485
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alexander-yakushev
changed the title
perf: Optimize validation
perf: Optimize validation with Malli
Aug 5, 2024
alexander-yakushev
force-pushed
the
opt-validation
branch
from
August 5, 2024 14:40
4d650a1
to
67fcddb
Compare
alexander-yakushev
force-pushed
the
opt-validation
branch
from
August 5, 2024 15:20
67fcddb
to
7249071
Compare
alexander-yakushev
force-pushed
the
opt-validation
branch
from
August 5, 2024 19:04
7249071
to
aba0048
Compare
alexander-yakushev
force-pushed
the
opt-validation
branch
from
August 5, 2024 20:32
e70dbde
to
8b9e056
Compare
piranha
approved these changes
Aug 6, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
I guess the change is mostly because of Malli, and reduce-kv
are a nice bonus?
The Malli improvements contribute the most, yes. But |
appleby
added a commit
that referenced
this pull request
Sep 2, 2024
src/metabase/lib/schema/util.cljc - perf: Optimize validation with Malli #46485 src/metabase/query_processor/util.clj - Use the new private defn #46013 ------------------------------------------------------------------------------- Disallow duplicate order-by clauses in ::lib.schema.order-by/order-bys (#47489) * Move query-processor.util/remove-lib-uuids to lib.schema.util This function will soon be needed in lib.schema.util in order to implement distinct order-by clause schema checking. This function feels like it should live in lib.util instead of lib.schema.util, but that would create the following circular import dependency since lib.util indirectly requires stuff from lib.schema.util: lib.schema.util -> lib.util -> lib.schema.util * Don't create queries with duplicate order-bys in remove_replace_test.cljc Otherwise, theses tests would fail soon when we add update the order-by schema to reject duplicates. * Declare lib.order-by/order-bys to return ::lib.schema.order-by/order-bys Previously it inlined the schema instead. * Disallow duplicate order-by clauses in ::lib.schema.order-by/order-bys Fixes: 39384
appleby
added a commit
that referenced
this pull request
Sep 2, 2024
…y/order-bys" #47532 Resolved minor conflicts in the following files due to unbackported PRs src/metabase/lib/schema/util.cljc - perf: Optimize validation with Malli #46485 src/metabase/query_processor/util.clj - Use the new private defn #46013 ------------------------------------------------------------------------------- Disallow duplicate order-by clauses in ::lib.schema.order-by/order-bys (#47489) * Move query-processor.util/remove-lib-uuids to lib.schema.util This function will soon be needed in lib.schema.util in order to implement distinct order-by clause schema checking. This function feels like it should live in lib.util instead of lib.schema.util, but that would create the following circular import dependency since lib.util indirectly requires stuff from lib.schema.util: lib.schema.util -> lib.util -> lib.schema.util * Don't create queries with duplicate order-bys in remove_replace_test.cljc Otherwise, theses tests would fail soon when we add update the order-by schema to reject duplicates. * Declare lib.order-by/order-bys to return ::lib.schema.order-by/order-bys Previously it inlined the schema instead. * Disallow duplicate order-by clauses in ::lib.schema.order-by/order-bys Fixes: 39384 Co-authored-by: Mike Appleby <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains various bits and pieces that make value validation with Malli more allocation-efficient (and somewhat faster). E.g., since #46167, this PR further reduces the allocations in the DB add/sync benchmark from 20 GB to ~15 GB.
Malli is updated to the latest version to include this: metosin/malli#1079.
satisfies?
is bad on hot paths because of https://clojure-goes-fast.com/blog/performance-tidbit-instanceof/, https://clojure.atlassian.net/browse/CLJ-1814.