google/cayley — pull request #101 by barakmich (2014-08-06 09:17:51+00:00)
Title: Add Materialize Iterator

Introducing the materialize iterator -- if it seems reasonable to just materialize a set instead of checking paths that might lead back, the And iterator can now add this layer as an optimization. It bails if used on sets that are too large, and is still ripe for cost/benefit tweaks, but in general will make deep queries a lot faster.

To wit, the benchmarks are now almost all short:
```
$ benchcmp master.txt aftermaterialize.txt
benchmark old ns/op new ns/op delta
BenchmarkNamePredicate 904393 898317 -0.67%
BenchmarkLargeSetsNoIntersection 150923975 54921214 -63.61%
BenchmarkVeryLargeSetsSmallIntersection 174235833178 463987963 -99.73%
BenchmarkHelplessContainsChecker 18569994238 15828325039 -14.76%
BenchmarkNetAndSpeed 32027611 16516696 -48.43%
BenchmarkKeanuAndNet 13430475 12509101 -6.86%
BenchmarkKeanuAndSpeed 15260371 14882936 -2.47%
BenchmarkKeanuOther 1133568511 74794130 -93.40%
BenchmarkKeanuBullockOther 124273081626 84608986 -99.93%
```

/cc @pbnjay @kortschak