Skip to content
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

fix(5305-slow-simplschema-validate): replace simpl-schema.validate() … #5306

Conversation

alex-haproff
Copy link
Contributor

Resolves #5305
Impact: minor
Type: performance

Issue

See #5305

Solution

Implement custom validators to use in place of simpl-schema validate() calls.

Breaking changes

None. The format of the exception message is different though.

Alex Haproff added 2 commits July 11, 2019 15:37
…method calls with custom validators to shave shave off response time

Signed-off-by: Alex Haproff <[email protected]>
Copy link
Contributor

@aldeed aldeed left a comment

Choose a reason for hiding this comment

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

@alex-haproff This looks good, but the new functions need jsdoc descriptions and where they are called I'd like to see a comment explaining that they are being used in place of SimpleSchema because execution speed is important in this function. Otherwise someone will probably come along someday and change it back to SimpleSchema.

Do you have any metrics on how much faster this is?

…n why simpl-schema was superseded by custom validators

Signed-off-by: Alex Haproff <[email protected]>
@alex-haproff
Copy link
Contributor Author

@aldeed thanks for the review. I've added JSDoc and also comments to explain.

@alex-haproff
Copy link
Contributor Author

@aldeed I've also created this gist (https://gist.github.com/alex-haproff/25be4a477b4785021d4eee53057e7861) to provide some metrics, please have a look.
60 runs on a moderate payload take around 700ms.

@aldeed aldeed merged commit f9c1720 into reactioncommerce:develop Jul 16, 2019
@alex-haproff alex-haproff deleted the fix-5305-slow-simplschema-validate branch July 16, 2019 20:51
@kieckhafer kieckhafer mentioned this pull request Aug 2, 2019
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.

2 participants