...
If it held the _seenPaths in a std::set() rather than a vector, it could check for prefix issues in O(N*logN) time. It may also be possible to use a StringMap to do it in O(N).
danielgrigg commented on Thu, 26 Oct 2017 06:51:30 +0000: Sweet! Thanks for getting this through so quickly! bernard.gorman commented on Thu, 26 Oct 2017 03:22:02 +0000: danielgrigg, this fix has now been backported to the 3.4 branch. Unfortunately, it narrowly missed the recent release of 3.4.10, but will be available in 3.4.11 (and, of course, in 3.6!) xgen-internal-githook commented on Thu, 26 Oct 2017 03:18:21 +0000: Author: {'email': 'bernard.gorman@gmail.com', 'name': 'Bernard Gorman', 'username': 'gormanb'} Message: SERVER-30449 Reimplement ProjectionSpecValidator::ensurePathDoesNotConflictOrThrow using std::set Branch: v3.4 https://github.com/mongodb/mongo/commit/1b740935e30f2e77bd1035194a402a52f0509f28 xgen-internal-githook commented on Wed, 11 Oct 2017 12:49:44 +0000: Author: {'email': 'bernard.gorman@gmail.com', 'name': 'Bernard Gorman', 'username': 'gormanb'} Message: SERVER-30449 Reimplement ProjectionSpecValidator::ensurePathDoesNotConflictOrThrow using std::set Branch: master https://github.com/mongodb/mongo/commit/bf805395e5943fe2db2391688b2eb124377e6456 david.storch commented on Tue, 10 Oct 2017 14:31:48 +0000: danielgrigg, we definitely plan to evaluate backport to the 3.4 branch once this is pushed to the master branch. Based on the proposed change in code review, a backport looks feasible. danielgrigg commented on Wed, 27 Sep 2017 06:51:39 +0000: Oh man I'm looking forward to this! Are there plans to back port to 3.4 cross fingers or will we have to wait for 3.6? bernard.gorman commented on Tue, 12 Sep 2017 14:42:38 +0000: Some more representative results, 100 iterations on standalone mongod built with --opt=on: master --opt=on master + patch --opt=on 3.2.16 GA { "_id" : null, "count" : 100, "min" : 40845, "max" : 47354, "avg" : 42613.16 } { "_id" : null, "count" : 100, "min" : 1345, "max" : 1550, "avg" : 1426.7 } { "_id" : null, "count" : 100, "min" : 1191, "max" : 1414, "avg" : 1286.78 } david.storch commented on Mon, 11 Sep 2017 21:57:13 +0000: bernard.gorman, woah! I am now satisfied with the resolution of SERVER-30633 as a dup of this ticket. Glad your initial work on this looks promising. bernard.gorman commented on Mon, 11 Sep 2017 21:28:57 +0000: Initial re-implementation with std::set and using the test data supplied by the customer on SERVER-30633 reduced the runtime on my laptop from ~17 minutes to... 7 seconds. Note that both runs were on mongod built with --opt=off. charlie.swanson commented on Thu, 31 Aug 2017 21:45:24 +0000: Moving to Needs Triage to re-evaluate as a team