WIP: step 19 - realised that the unit test used to replicate the problem seen at the client site may well be just trivially causing an out-of-memory through the sheer number of test variables. While this is itself a useful case to consider, it isn't the same problem as seen at the client site - the latter actually sees full test vectors, albeit very slowly, whereas the test here is simply bombing out before *any* partial test vectors are presented for merging. Have cut down the test to see if I can observe a difference in running time before and after optimising via shared path prefix.
WIP step 1: introduce replacement for 'Map' - 'MapWithRunLengths'. Currently just an minimal API with no implementation.
WIP step 2 - incomplete (and incorrect) implementation of 'MapWithRunLengths'. Has some stuff worth salvaging, so I'll make this checkpoint commit.
Correct spelling typo.
WIP step 3 - starting to pass some tests, but some of the tests are either spinning in infinite loops or are taking a *very* long time to run. The implementation really could do with sprucing up - but in it goes as a checkpoint.
WIP step 4 - some fixes resulting from self-review of the implementation of 'MapWithRunLengths'. Still have at least one outstanding bug and unimplemented functionality on top of this.
WIP step 5 - fix for incorrect bug-fix in previous commit (hmm) plus some more unimplemented functionality. Still got major test breakages.
WIP step 6 - implement more missing pieces, still have big test breakage which is confirmed in some tests that now break non-trivially with the extra implementation.
WIP step 7 - more bug fixes, passing the Node unit tests now, but still have breakage for the all-up tests.
WIP step 8 - add in some temporary postcondition checking - not very efficient and messy code duplication, hence the temporary nature. Postconditions are not violated despite the ongoing test failures.
WIP step 9 - more postcondition checking. Still got breakage - but now think it's from elsewhere!
WIP step 10 - bugfix for change made at the base of this branch - I had assumed a collection was ordered when it wasn't. This seems to have solved one bug and unearthed another - so the tests now break in a different way. Investigating...
Transplanted partial commit from branch 'mapWithRunLengthsExperiment'. Introduces a bug due to one of the collections being generated in a random order of test variable indices (should have been sorted).
Transplanted partial commit from branch 'mapWithRunLengthsExperiment'. 
WIP step 10 - bugfix for change made at the base of this branch - I had assumed a collection was ordered when it wasn't. This seems to have solved one bug and unearthed another - so the tests now break in a different way. Investigating...
Fix bug exposed on this branch by previous commit - test variable indices excluded during the filling out of partial test vectors could include previously excluded indices already marked in the input partial test vector. This used to be a benign bug as the resulting duplicate entries were simply disregarded, however the cutover implementation on this branch regards such duplicates correctly as a precondition failure. This commit stops creation of such duplicates.
Use tail recursion when filling out partial test vectors.
Merge in bugfixes for problems originally spotted on this branch but present in the parent branch (and thus fixed on a separate bug-fix branch sharing the same parent as this).
WIP step 11 - amended postcondition for'MapWithRunLengths.Add' to take into consideration the no-operation case where an existing key-value pair is added into the same map repeatedly.
Turned up the dials on test 'StressCopiousUseOfInterleavesMotivatedByBuildingLogicalExpressionTestCases'. Causes an OOM at around 1.5G of memory usage!
Merge of bugfix for filling out of partial test vectors from 'InvestigateBugInFillingOutPartialTestVector'.