Skip to content

Commit

Permalink
Added benchmark comparisons between toArray() and map()
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Apr 23, 2015
1 parent 462b6eb commit e0e2d31
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions benchmarks/mongodb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion benchmarks/mongodb.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions benchmarks/mongodb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class IridiumDB extends Iridium.Core {
super({ database: 'test' });
}

User = new Iridium.Model<User, User>(this, User, 'iridium', {
User = new Iridium.Model<User, User>(this, (model, doc) => doc, 'iridium', {
name: String,
surname: String,
birthday: Date
Expand Down Expand Up @@ -90,8 +90,10 @@ iDB.connect()
});
});
}))
.then(() => benchmark("Iridium Instances finding 10 000 documents: %s", () => iDB.UserWrapped.find(), baseline))
.then(() => benchmark("Iridium finding 10 000 documents: %s", () => iDB.User.find(), baseline))
.then(() => benchmark("Iridium Instances finding 10 000 documents (toArray): %s",() => iDB.UserWrapped.find().toArray(), baseline))
.then(() => benchmark("Iridium finding 10 000 documents (toArray): %s",() => iDB.User.find().toArray(), baseline))
.then(() => benchmark("Iridium Instances finding 10 000 documents (map): %s",() => iDB.UserWrapped.find().map(x => x), baseline))
.then(() => benchmark("Iridium finding 10 000 documents (map): %s",() => iDB.User.find().map(x => x), baseline))

.then(() => benchmark("MongoDB removing 10 000 documents: %s", () => {
return new Promise<any>((resolve, reject) => {
Expand Down

0 comments on commit e0e2d31

Please sign in to comment.