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

investigate not using SlateError objects #2708

Closed
ianstormtaylor opened this issue Apr 25, 2019 · 1 comment
Closed

investigate not using SlateError objects #2708

ianstormtaylor opened this issue Apr 25, 2019 · 1 comment

Comments

@ianstormtaylor
Copy link
Owner

ianstormtaylor commented Apr 25, 2019

Do you want to request a feature or report a bug?

Idea.

What's the current behavior?

Right now when doing normalization we create SlateError objects:

const error = new SlateError(failure.code, failure)

Creating errors objects is a lot more expensive than creating objects: https://jsperf.com/error-vs-object-instantiation

There's a chance that these are expensive from a performance stand point if we're doing tons of validations. I'm not sure... I guess the normal case involves most things being valid and not invalid.

But it could be something to check out, since there's no real exception being raised, we don't need a full blown error object. And if it improves performance of normalization that could be big.

@ianstormtaylor
Copy link
Owner Author

Fixed by #3093.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant