From 109e656f0bc4b40e37586f695aa5eaba82d388ab Mon Sep 17 00:00:00 2001 From: Eric Cox Date: Wed, 29 Sep 2021 20:48:52 +0000 Subject: [PATCH 1/6] add group tests --- testcases/pipelines.js | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/testcases/pipelines.js b/testcases/pipelines.js index b6f267e3..835a3258 100644 --- a/testcases/pipelines.js +++ b/testcases/pipelines.js @@ -257,20 +257,36 @@ generateTestCase({ generateTestCase({name: "Group.All", pipeline: [{$group: {_id: "constant"}}]}); -generateTestCase({ - name: "Group.TenGroups", + generateTestCase({ + name: "Group.TenGroups", + nDocs: 100000, docGenerator: function basicGroupDocGenerator(i) { - return {_id: i, _idMod10: i % 10}; + let quote_text = + 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; + let quote = {author: "Jane Austen", work: "Pride and Prejudice", quote: quote_text}; + return {_id: i, _idMod10: i % 10, quotes: [quote, quote, quote, quote, quote]}; }, pipeline: [{$group: {_id: "$_idMod10"}}] }); generateTestCase({ - name: "Group.TenGroupsWithAvg", + name: "Group.SBECollscanOnly", docGenerator: function basicGroupDocGenerator(i) { return {_id: i, _idMod10: i % 10}; }, - pipeline: [{$group: {_id: "$_idMod10", avg: {$avg: "$_id"}}}] + pipeline: [{$_internalInhibitOptimization: {}}, {$group: {_id: "$_idMod10"}}] +}); + +generateTestCase({ + name: "Group.TenGroupsWithSum", + nDocs: 500000, + docGenerator: function basicGroupDocGenerator(i) { + let quote_text = + 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; + let quote = {author: "Jane Austen", work: "Pride and Prejudice", quote: quote_text}; + return {_id: i, _idMod10: i % 10, quotes: [quote, quote, quote, quote, quote]}; + }, + pipeline: [{$group: {_id: "$_idMod10", s: {$sum: "$_id"}}}] }); /** From 1c5d5177abb27e43a69d2aec5799e4e002218377 Mon Sep 17 00:00:00 2001 From: Eric Cox Date: Wed, 29 Sep 2021 22:59:09 +0000 Subject: [PATCH 2/6] 50k --- testcases/pipelines.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testcases/pipelines.js b/testcases/pipelines.js index 835a3258..870bafa9 100644 --- a/testcases/pipelines.js +++ b/testcases/pipelines.js @@ -259,7 +259,7 @@ generateTestCase({name: "Group.All", pipeline: [{$group: {_id: "constant"}}]}); generateTestCase({ name: "Group.TenGroups", - nDocs: 100000, + nDocs: 50000, docGenerator: function basicGroupDocGenerator(i) { let quote_text = 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; @@ -279,7 +279,7 @@ generateTestCase({ generateTestCase({ name: "Group.TenGroupsWithSum", - nDocs: 500000, + nDocs: 50000, docGenerator: function basicGroupDocGenerator(i) { let quote_text = 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; From 3269be18e8836f0aefa5e2eb8c5ba3c6b8fdd8be Mon Sep 17 00:00:00 2001 From: Eric Cox Date: Thu, 30 Sep 2021 03:21:51 +0000 Subject: [PATCH 3/6] undo test --- testcases/pipelines.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/testcases/pipelines.js b/testcases/pipelines.js index 870bafa9..312c3162 100644 --- a/testcases/pipelines.js +++ b/testcases/pipelines.js @@ -269,14 +269,6 @@ generateTestCase({name: "Group.All", pipeline: [{$group: {_id: "constant"}}]}); pipeline: [{$group: {_id: "$_idMod10"}}] }); -generateTestCase({ - name: "Group.SBECollscanOnly", - docGenerator: function basicGroupDocGenerator(i) { - return {_id: i, _idMod10: i % 10}; - }, - pipeline: [{$_internalInhibitOptimization: {}}, {$group: {_id: "$_idMod10"}}] -}); - generateTestCase({ name: "Group.TenGroupsWithSum", nDocs: 50000, From 3f630a689d48cabf0e3c8fbc43dd70fc67fe938e Mon Sep 17 00:00:00 2001 From: Eric Cox Date: Thu, 30 Sep 2021 03:23:30 +0000 Subject: [PATCH 4/6] n=100000 --- testcases/pipelines.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testcases/pipelines.js b/testcases/pipelines.js index 312c3162..12b8bbdd 100644 --- a/testcases/pipelines.js +++ b/testcases/pipelines.js @@ -259,7 +259,7 @@ generateTestCase({name: "Group.All", pipeline: [{$group: {_id: "constant"}}]}); generateTestCase({ name: "Group.TenGroups", - nDocs: 50000, + nDocs: 100000, docGenerator: function basicGroupDocGenerator(i) { let quote_text = 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; @@ -271,7 +271,7 @@ generateTestCase({name: "Group.All", pipeline: [{$group: {_id: "constant"}}]}); generateTestCase({ name: "Group.TenGroupsWithSum", - nDocs: 50000, + nDocs: 100000, docGenerator: function basicGroupDocGenerator(i) { let quote_text = 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; From f907ac6e00581025db4bbf8776eb5a044ff5354d Mon Sep 17 00:00:00 2001 From: Eric Cox Date: Thu, 30 Sep 2021 21:11:12 +0000 Subject: [PATCH 5/6] more documents --- testcases/pipelines.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testcases/pipelines.js b/testcases/pipelines.js index 12b8bbdd..54620605 100644 --- a/testcases/pipelines.js +++ b/testcases/pipelines.js @@ -264,7 +264,7 @@ generateTestCase({name: "Group.All", pipeline: [{$group: {_id: "constant"}}]}); let quote_text = 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; let quote = {author: "Jane Austen", work: "Pride and Prejudice", quote: quote_text}; - return {_id: i, _idMod10: i % 10, quotes: [quote, quote, quote, quote, quote]}; + return {_id: i, _idMod10: i % 10, quotes: [quote, quote, quote, quote, quote, quote, quote, quote]}; }, pipeline: [{$group: {_id: "$_idMod10"}}] }); @@ -276,7 +276,7 @@ generateTestCase({ let quote_text = 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; let quote = {author: "Jane Austen", work: "Pride and Prejudice", quote: quote_text}; - return {_id: i, _idMod10: i % 10, quotes: [quote, quote, quote, quote, quote]}; + return {_id: i, _idMod10: i % 10, quotes: [quote, quote, quote, quote, quote, quote, quote, quote]}; }, pipeline: [{$group: {_id: "$_idMod10", s: {$sum: "$_id"}}}] }); From 1d5d7fb27bd4c310fcb263169da9c286ae9dacab Mon Sep 17 00:00:00 2001 From: Eric Cox Date: Tue, 5 Oct 2021 17:17:54 +0000 Subject: [PATCH 6/6] perf tests for --- testcases/pipelines.js | 226 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 224 insertions(+), 2 deletions(-) diff --git a/testcases/pipelines.js b/testcases/pipelines.js index 54620605..e4453562 100644 --- a/testcases/pipelines.js +++ b/testcases/pipelines.js @@ -259,7 +259,7 @@ generateTestCase({name: "Group.All", pipeline: [{$group: {_id: "constant"}}]}); generateTestCase({ name: "Group.TenGroups", - nDocs: 100000, + nDocs: 200000, docGenerator: function basicGroupDocGenerator(i) { let quote_text = 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; @@ -269,9 +269,97 @@ generateTestCase({name: "Group.All", pipeline: [{$group: {_id: "constant"}}]}); pipeline: [{$group: {_id: "$_idMod10"}}] }); +generateTestCase({ + name: "Group.TenGroupsTwoStackedNoAcc", + nDocs: 200000, + docGenerator: function basicGroupDocGenerator(i) { + let quote_text = + 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; + let quote = {author: "Jane Austen", work: "Pride and Prejudice", quote: quote_text}; + return {_id: i, _idMod10: i % 10, + a: (i + 1) % 10000, + b: i + 2, + c: i + 3, + d: i + 4, + e: i + 5, + f: i + 6, + g: i + 7, + h: i + 8, + quotes: [quote, quote, quote, quote, quote]}; + }, + pipeline: [{$group: {_id: "$a"}}, {$group: {_id: "$b"}}] +}); + +generateTestCase({ + name: "Group.TenGroupsThreeStackedNoAcc", + nDocs: 200000, + docGenerator: function basicGroupDocGenerator(i) { + let quote_text = + 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; + let quote = {author: "Jane Austen", work: "Pride and Prejudice", quote: quote_text}; + return {_id: i, _idMod10: i % 10, + a: (i + 1) % 10000, + b: i + 2, + c: i + 3, + d: i + 4, + e: i + 5, + f: i + 6, + g: i + 7, + h: i + 8, + quotes: [quote, quote, quote, quote, quote]}; + }, + pipeline: + [{$group: {_id: "$a"}}, {$group: {_id: "$b"}}, {$group: {_id: "$c"}}] +}); + +generateTestCase({ + name: "Group.TenGroupsFourStackedNoAcc", + nDocs: 200000, + docGenerator: function basicGroupDocGenerator(i) { + let quote_text = + 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; + let quote = {author: "Jane Austen", work: "Pride and Prejudice", quote: quote_text}; + return {_id: i, _idMod10: i % 10, + a: (i + 1) % 10000, + b: i + 2, + c: i + 3, + d: i + 4, + e: i + 5, + f: i + 6, + g: i + 7, + h: i + 8, + quotes: [quote, quote, quote, quote, quote]}; + }, + pipeline: + [{$group: {_id: "$a"}}, {$group: {_id: "$b"}}, {$group: {_id: "$c"}}, {$group: {_id: "$d"}}] +}); + +generateTestCase({ + name: "Group.TenGroupsEightStackedNoAcc", + nDocs: 200000, + docGenerator: function basicGroupDocGenerator(i) { + let quote_text = + 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; + let quote = {author: "Jane Austen", work: "Pride and Prejudice", quote: quote_text}; + return {_id: i, _idMod10: i % 10, + a: (i + 1) % 10000, + b: i + 2, + c: i + 3, + d: i + 4, + e: i + 5, + f: i + 6, + g: i + 7, + h: i + 8, + quotes: [quote, quote, quote, quote, quote]}; + }, + pipeline: + [{$group: {_id: "$a"}}, {$group: {_id: "$b"}}, {$group: {_id: "$c"}}, {$group: {_id: "$d"}}, + {$group: {_id: "$e"}}, {$group: {_id: "$f"}}, {$group: {_id: "$g"}}, {$group: {_id: "$h"}}] +}); + generateTestCase({ name: "Group.TenGroupsWithSum", - nDocs: 100000, + nDocs: 200000, docGenerator: function basicGroupDocGenerator(i) { let quote_text = 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; @@ -281,6 +369,140 @@ generateTestCase({ pipeline: [{$group: {_id: "$_idMod10", s: {$sum: "$_id"}}}] }); +generateTestCase({ + name: "Group.TenGroupsWithTwoSums", + nDocs: 200000, + docGenerator: function basicGroupDocGenerator(i) { + let quote_text = + 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; + let quote = {author: "Jane Austen", work: "Pride and Prejudice", quote: quote_text}; + return {_id: i, _idMod10: i % 10, quotes: [quote, quote, quote, quote, quote]}; + }, + pipeline: [{$group: {_id: "$_idMod10", s1: {$sum: "$_id"}, s2: {$sum: "$_id"}}}] +}); + +generateTestCase({ + name: "Group.TenGroupsWithFourSums", + nDocs: 200000, + docGenerator: function basicGroupDocGenerator(i) { + let quote_text = + 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; + let quote = {author: "Jane Austen", work: "Pride and Prejudice", quote: quote_text}; + return {_id: i, _idMod10: i % 10, quotes: [quote, quote, quote, quote, quote]}; + }, + pipeline: + [{$group: {_id: "$_idMod10", s1: {$sum: "$_id"}, s2: {$sum: "$_id"}, s3: {$sum: "$_id"}}}] +}); + +generateTestCase({ + name: "Group.TenGroupsWithSixSums", + nDocs: 200000, + docGenerator: function basicGroupDocGenerator(i) { + let quote_text = + 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; + let quote = {author: "Jane Austen", work: "Pride and Prejudice", quote: quote_text}; + return {_id: i, _idMod10: i % 10, quotes: [quote, quote, quote, quote, quote]}; + }, + pipeline: [{ + $group: { + _id: "$_idMod10", + s1: {$sum: "$_id"}, + s2: {$sum: "$_id"}, + s3: {$sum: "$_id"}, + s4: {$sum: "$_id"}, + s5: {$sum: "$_id"}, + s6: {$sum: "$_id"} + } + }] +}); + +generateTestCase({ + name: "Group.TenGroupsWithEightSums", + nDocs: 200000, + docGenerator: function basicGroupDocGenerator(i) { + let quote_text = + 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; + let quote = {author: "Jane Austen", work: "Pride and Prejudice", quote: quote_text}; + return {_id: i, _idMod10: i % 10, quotes: [quote, quote, quote, quote, quote]}; + }, + pipeline: [{ + $group: { + _id: "$_idMod10", + s1: {$sum: "$_id"}, + s2: {$sum: "$_id"}, + s3: {$sum: "$_id"}, + s4: {$sum: "$_id"}, + s5: {$sum: "$_id"}, + s6: {$sum: "$_id"}, + s7: {$sum: "$_id"}, + s8: {$sum: "$_id"} + } + }] +}); + +generateTestCase({ + name: "Group.TenGroupsWithTenSums", + nDocs: 200000, + docGenerator: function basicGroupDocGenerator(i) { + let quote_text = + 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; + let quote = {author: "Jane Austen", work: "Pride and Prejudice", quote: quote_text}; + return {_id: i, _idMod10: i % 10, quotes: [quote, quote, quote, quote, quote]}; + }, + pipeline: [{ + $group: { + _id: "$_idMod10", + s1: {$sum: "$_id"}, + s2: {$sum: "$_id"}, + s3: {$sum: "$_id"}, + s4: {$sum: "$_id"}, + s5: {$sum: "$_id"}, + s6: {$sum: "$_id"}, + s7: {$sum: "$_id"}, + s8: {$sum: "$_id"}, + s9: {$sum: "$_id"}, + s10: {$sum: "$_id"} + } + }] +}); + +generateTestCase({ + name: "Group.TenGroupsWithTwentySums", + nDocs: 200000, + docGenerator: function basicGroupDocGenerator(i) { + let quote_text = + 'There are few people whom I really love, and still fewer of whom I think well. The more I see of the world, the more am I dissatisfied with it; and every day confirms my belief of the inconsistency of all human characters, and of the little dependence that can be placed on the appearance of merit or sense.'; + let quote = {author: "Jane Austen", work: "Pride and Prejudice", quote: quote_text}; + return {_id: i, _idMod10: i % 10, quotes: [quote, quote, quote, quote, quote]}; + }, + pipeline: [{ + $group: { + _id: "$_idMod10", + s1: {$sum: "$_id"}, + s2: {$sum: "$_id"}, + s3: {$sum: "$_id"}, + s4: {$sum: "$_id"}, + s5: {$sum: "$_id"}, + s6: {$sum: "$_id"}, + s7: {$sum: "$_id"}, + s8: {$sum: "$_id"}, + s9: {$sum: "$_id"}, + s10: {$sum: "$_id"}, + s11: {$sum: "$_id"}, + s12: {$sum: "$_id"}, + s13: {$sum: "$_id"}, + s14: {$sum: "$_id"}, + s15: {$sum: "$_id"}, + s16: {$sum: "$_id"}, + s17: {$sum: "$_id"}, + s18: {$sum: "$_id"}, + s19: {$sum: "$_id"}, + s20: {$sum: "$_id"} + } + }] +}); + + /** * Pair of document generator functions used for testing $minN and $maxN as accumulators and window * functions.