Last active
December 17, 2015 16:36
-
-
Save thstarshine/7df5cd021a8d0b9c5976 to your computer and use it in GitHub Desktop.
mongoose w/ bluebird promise performance test
This file contains hidden or 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
| mongoose schema: | |
| update: function(row){ | |
| return this.update({}, row).exec(); | |
| } | |
| // method 1 | |
| batchUpdate: function(rows){ | |
| return Promise.map(rows, function(row){ | |
| return self.update({}, row).exec(); | |
| }); | |
| } | |
| another js: | |
| // method 2 | |
| return Promise.map(rows, function(row){ | |
| return model.update(row); | |
| }); | |
| // method 1 is twice faster than method 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment