Closed malaire closed 3 years ago
@mgold Do you think this is related to the diffing algorithm, or inherent to the fact that elm-test doesn't hold the values in the failures?
In the second case, wouldn't it be worth adding the values there, even if that meant Test a
, Expectation a
, etc.? Would it also mean:
-Expect.equal : a -> a -> Expectation
+Expect.equal : comparable -> comparable -> Expectation comparable
?
Almost all the time running the test is spent in this function: https://github.com/jinjor/elm-diff/blob/master/src/Diff.elm#L322 . The elm-diff package itself seems to be really well written so there's not much performance gain available there. The underlying algorithm is just O(n^2) worst case so there's not much we can do about it.
We could add a cutoff point and just not diff the outputs if they're too large; that works, but gives worse error messages. A good cutoff point would be when Debug.toString actual
or Debug.toString expected
are longer than 300 characters.
This is fixed on master now
This test takes about 120 seconds to run even though it's trivial comparison of
( List String, Int )
with 312String
:s.