Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shrinking is Insanely Slow for write_read #596

Open
BebeSparkelSparkel opened this issue May 23, 2024 · 7 comments · May be fixed by #597
Open

Shrinking is Insanely Slow for write_read #596

BebeSparkelSparkel opened this issue May 23, 2024 · 7 comments · May be fixed by #597

Comments

@BebeSparkelSparkel
Copy link
Contributor

BebeSparkelSparkel commented May 23, 2024

Just one test took ~25 minutes due to shrinking. https://github.com/haskell/text/actions/runs/9201285542/job/25309228763?pr=590#step:6:1224

Should noShrinking be added?

@Bodigrim
Copy link
Contributor

I imagine at the very least we don't want to shrink first three arguments of

  propTest :: TextEncoding -> Gen IO.BufferMode -> IO.NewlineMode -> c -> Property

@BebeSparkelSparkel
Copy link
Contributor Author

The encoding is not shrunk. I have wrapped the other two with NoShrink but without much improvement. See #597

@Bodigrim
Copy link
Contributor

      input-output
        t_write_read
          UTF-8
            NoBuffering:                                      OK (0.80s)
              +++ OK, passed 100 tests; 39 discarded.
            LineBuffering:                                    OK (0.10s)
              +++ OK, passed 100 tests; 27 discarded.
            BlockBuffering:                                   FAIL (1448.46s)
              *** Failed! (after 72 tests and 2007 shrinks):
              Exception:
                Assertion failed
                CallStack (from HasCallStack):
                  assert, called at src/Data/Text/IO.hs:249:35 in text-2.1.1-inplace:Data.Text.IO
              NewlineMode {inputNL = LF, outputNL = LF}
              ["aaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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","","aaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]
              BlockBuffering (Just 4)
              Use --quickcheck-replay=934323 to reproduce.
              Use -p '/t_write_read.UTF-8.BlockBuffering/' to rerun this test only.

2007 shrinks is a high number, but on the other hand why did they take 1448 seconds? That's 0.7 seconds per test, which sounds a lot, given that the test data does not seem to be that huge.

@BebeSparkelSparkel
Copy link
Contributor Author

BebeSparkelSparkel commented May 25, 2024

I think many more tests are run than 2007. If you look at numShrinkTries, so I think 2007 represents numShrinks but the number of tries is not shown.

@BebeSparkelSparkel
Copy link
Contributor Author

I imagine there are so many shrinks tried because there are many variables to shrink

  • length of list
  • length of each text
  • every character

I think if the character variable is removed this would perform much better. Either, do not modify the characters or set them all to 'a'.

@Bodigrim
Copy link
Contributor

Dunno, maybe lumping NoShrink is the simplest solution. I'm not too keen to have a custom wrapper with instance Arbitrary here...

@BebeSparkelSparkel
Copy link
Contributor Author

BebeSparkelSparkel commented May 26, 2024

I just added NoShrink to quickcheck and it has been pulled nick8325/quickcheck#408. We could up the version of quickcheck and use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants