From e0e2d316cc5473d30f43a5f886825a3acafbaa87 Mon Sep 17 00:00:00 2001 From: Benjamin Pannell Date: Thu, 23 Apr 2015 22:03:16 +0200 Subject: [PATCH] Added benchmark comparisons between toArray() and map() --- benchmarks/mongodb.js | 4 ++-- benchmarks/mongodb.js.map | 2 +- benchmarks/mongodb.ts | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/benchmarks/mongodb.js b/benchmarks/mongodb.js index 5f72fb6..99651fa 100644 --- a/benchmarks/mongodb.js +++ b/benchmarks/mongodb.js @@ -26,7 +26,7 @@ var IridiumDB = (function (_super) { __extends(IridiumDB, _super); function IridiumDB() { _super.call(this, { database: 'test' }); - this.User = new Iridium.Model(this, User, 'iridium', { + this.User = new Iridium.Model(this, function (model, doc) { return doc; }, 'iridium', { name: String, surname: String, birthday: Date @@ -86,7 +86,7 @@ iDB.connect().then(function () { return iDB.User.remove(); }).then(function () { return resolve(objects); }); }); -}); }).then(function () { return benchmark("Iridium Instances finding 10 000 documents: %s", function () { return iDB.UserWrapped.find(); }, baseline); }).then(function () { return benchmark("Iridium finding 10 000 documents: %s", function () { return iDB.User.find(); }, baseline); }).then(function () { return benchmark("MongoDB removing 10 000 documents: %s", function () { +}); }).then(function () { return benchmark("Iridium Instances finding 10 000 documents (toArray): %s", function () { return iDB.UserWrapped.find().toArray(); }, baseline); }).then(function () { return benchmark("Iridium finding 10 000 documents (toArray): %s", function () { return iDB.User.find().toArray(); }, baseline); }).then(function () { return benchmark("Iridium Instances finding 10 000 documents (map): %s", function () { return iDB.UserWrapped.find().map(function (x) { return x; }); }, baseline); }).then(function () { return benchmark("Iridium finding 10 000 documents (map): %s", function () { return iDB.User.find().map(function (x) { return x; }); }, baseline); }).then(function () { return benchmark("MongoDB removing 10 000 documents: %s", function () { return new Promise(function (resolve, reject) { iDB.connection.collection('mongodb').remove(function (err, objects) { if (err) diff --git a/benchmarks/mongodb.js.map b/benchmarks/mongodb.js.map index 81dd249..378cf07 100644 --- a/benchmarks/mongodb.js.map +++ b/benchmarks/mongodb.js.map @@ -1 +1 @@ -{"version":3,"file":"mongodb.js","sourceRoot":"","sources":["mongodb.ts"],"names":["User","User.constructor","WrappedUser","WrappedUser.constructor","IridiumDB","IridiumDB.constructor","benchmark"],"mappings":";;;;;;AACA,AADA,4CAA4C;AAC5C,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AACrC,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AAGrC,IAAI,OAAO,GAAG,EAAE,CAAC;AACjB,GAAG,CAAA,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE;IACzB,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;AAEzE,IAAM,IAAI;IAAVA,SAAMA,IAAIA;IAKVC,CAACA;IAADD,WAACA;AAADA,CAACA,AALD,IAKC;AAED,IAAM,WAAW;IAASE,UAApBA,WAAWA,UAA4CA;IAA7DA,SAAMA,WAAWA;QAASC,8BAAmCA;IAK7DA,CAACA;IAADD,kBAACA;AAADA,CAACA,AALD,EAA0B,OAAO,CAAC,QAAQ,EAKzC;AAED,IAAM,SAAS;IAASE,UAAlBA,SAASA,UAAqBA;IAChCA,SADEA,SAASA;QAEPC,kBAAMA,EAAEA,QAAQA,EAAEA,MAAMA,EAAEA,CAACA,CAACA;QAGhCA,SAAIA,GAAGA,IAAIA,OAAOA,CAACA,KAAKA,CAAaA,IAAIA,EAAEA,IAAIA,EAAEA,SAASA,EAAEA;YACxDA,IAAIA,EAAEA,MAAMA;YACZA,OAAOA,EAAEA,MAAMA;YACfA,QAAQA,EAAEA,IAAIA;SACjBA,CAACA,CAACA;QAEHA,gBAAWA,GAAGA,IAAIA,OAAOA,CAACA,KAAKA,CAAoBA,IAAIA,EAAEA,WAAWA,EAAEA,gBAAgBA,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AAuC,EAAE;IAC3D,MAAM,CAAC,IAAI,OAAO,CAAM,UAAC,OAAO,EAAE,MAAM;QACpC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,UAAC,GAAG,EAAE,OAAY;YAC1D,EAAE,CAAA,CAAC,GAAG,CAAC;gBAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC3B,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,EAPU,CAOV,CAAC,CACF,IAAI,CAAC,cAAM,OAAA,SAAS,CAAC,iDAAiD,EAAE,cAAM,OAAA,GAAG,CAAC,WAAW,CAAC,MAAM,EAAE,EAAxB,CAAwB,EAAE,QAAQ,CAAC,EAAtG,CAAsG,CAAC,CAClH,IAAI,CAAC,cAAM,OAAA,SAAS,CAAC,uCAAuC,EAAE,cAAM,OAAA,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,EAAjB,CAAiB,EAAE,QAAQ,CAAC,EAArF,CAAqF,CAAC,CAEjG,IAAI,CAAC,cAAM,OAAA,GAAG,CAAC,KAAK,EAAE,EAAX,CAAW,CAAC,CACvB,KAAK,CAAC,UAAC,GAAG,IAAK,OAAA,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAlB,CAAkB,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"mongodb.js","sourceRoot":"","sources":["mongodb.ts"],"names":["User","User.constructor","WrappedUser","WrappedUser.constructor","IridiumDB","IridiumDB.constructor","benchmark"],"mappings":";;;;;;AACA,AADA,4CAA4C;AAC5C,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AACrC,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AAGrC,IAAI,OAAO,GAAG,EAAE,CAAC;AACjB,GAAG,CAAA,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG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IAAI,QAAC,EAAD,CAAC,CAAC,EAA3B,CAA2B,EAAE,QAAQ,CAAC,EAAnG,CAAmG,CAAC,CAE/G,IAAI,CAAC,cAAM,OAAA,SAAS,CAAC,uCAAuC,EAAE;IAC3D,MAAM,CAAC,IAAI,OAAO,CAAM,UAAC,OAAO,EAAE,MAAM;QACpC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,UAAC,GAAG,EAAE,OAAY;YAC1D,EAAE,CAAA,CAAC,GAAG,CAAC;gBAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC3B,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,EAPU,CAOV,CAAC,CACF,IAAI,CAAC,cAAM,OAAA,SAAS,CAAC,iDAAiD,EAAE,cAAM,OAAA,GAAG,CAAC,WAAW,CAAC,MAAM,EAAE,EAAxB,CAAwB,EAAE,QAAQ,CAAC,EAAtG,CAAsG,CAAC,CAClH,IAAI,CAAC,cAAM,OAAA,SAAS,CAAC,uCAAuC,EAAE,cAAM,OAAA,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,EAAjB,CAAiB,EAAE,QAAQ,CAAC,EAArF,CAAqF,CAAC,CAEjG,IAAI,CAAC,cAAM,OAAA,GAAG,CAAC,KAAK,EAAE,EAAX,CAAW,CAAC,CACvB,KAAK,CAAC,UAAC,GAAG,IAAK,OAAA,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAlB,CAAkB,CAAC,CAAC"} \ No newline at end of file diff --git a/benchmarks/mongodb.ts b/benchmarks/mongodb.ts index d06df40..d7db0a8 100644 --- a/benchmarks/mongodb.ts +++ b/benchmarks/mongodb.ts @@ -26,7 +26,7 @@ class IridiumDB extends Iridium.Core { super({ database: 'test' }); } - User = new Iridium.Model(this, User, 'iridium', { + User = new Iridium.Model(this, (model, doc) => doc, 'iridium', { name: String, surname: String, birthday: Date @@ -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((resolve, reject) => {