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

Multiple Validation in parallel #43

Closed
saransh2012 opened this issue Jul 12, 2013 · 2 comments
Closed

Multiple Validation in parallel #43

saransh2012 opened this issue Jul 12, 2013 · 2 comments

Comments

@saransh2012
Copy link

I want to know if each validation is done in parallel or in series?
Lets use your example

req.checkBody('postparam', 'Invalid postparam').notEmpty().isInt();
req.assert('getparam', 'Invalid getparam').isInt();
req.assert('urlparam', 'Invalid urlparam').isAlpha();

I basically want to know if all of the 3 are run is series or in parallel. I want to do this in parallel as that would make it more fast. I think they are in parallel already but not sure, so asking. Please let me know fast.
If they are not in parallel is it possible to make them parallel using async module?

@arb
Copy link
Contributor

arb commented Jul 18, 2013

They are not in parallel. Unless the validation is an asynchronous function or something that is I/O blocking, there would be no performance gain by trying to do this in parallel. In fact, there would be less efficient because of the additional overhead of using async and managing those callbacks.

JavaScript/Node.js is single threaded.

@arb arb closed this as completed Jul 19, 2013
@lock
Copy link

lock bot commented Jun 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants