[PATCH] D23156: [ADT] Stop trying to test every combination of values in a triple in every permutation.

Dean Michael Berris via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 4 18:10:08 PDT 2016


dberris added inline comments.

================
Comment at: unittests/ADT/TripleTest.cpp:306-310
@@ +305,7 @@
+  //
+  // We don't check every possible combination because that set is ever growing
+  // and intractable to test quickly. But we check every option for any given
+  // slot and make sure it gets normalized to the correct position from every
+  // permutation. This should cover the core logic while being a tractable
+  // number of tests.
+  auto FirstArchType = Triple::ArchType(Triple::UnknownArch + 1);
----------------
dberris wrote:
> I think in-lining the computation in the reduction of the number of tests here would be useful (instead of just having it in the description). For example, it's useful to know that if we do the Cartesian Product and permute each of the tuples in that space, we get the following number of test-cases:
> 
>     X = (|Arch| * |Vendor| * |OS| * |Env|) * 4!
> 
> This patch cuts it down to:
> 
>     Y = (|Arch| + |Vendor| + |OS| + |Env|) * 4! * 4
> 
> That's the difference between a geometric series and an arithmetic series -- i.e. if any one of the sets grows by N, that X grows exponentially compared to linearly to Y.
> That's the difference between a geometric series and an arithmetic series -- i.e. if any one of the sets grows by N, that X grows exponentially compared to linearly to Y.

Actually, scratch this part (I didn't know why I was thinking about it as a geometric series). It's the difference between N^4 and N where N is the cardinality of the largest set.


https://reviews.llvm.org/D23156





More information about the llvm-commits mailing list