haskell / attoparsec

A fast Haskell library for parsing ByteStrings
http://hackage.haskell.org/package/attoparsec
Other
514 stars 93 forks source link

Make benchmarks buildable + fix segmentation fault with text-2.0 #199

Closed Bodigrim closed 2 years ago

Bodigrim commented 2 years ago

Current project structure is both convoluted and not achieving the goal: both test and benchmark components refer not to the library, but directly to hs-source-dir: ., and still cabal bench fails with

Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: attoparsec-0.14.3 (user goal)
[__1] rejecting: attoparsec:!bench (constraint from config file, command line
flag, or user target requires opposite flag selection)
[__1] trying: attoparsec:*bench
[__2] trying: criterion-1.5.12.0 (dependency of attoparsec *bench)
[__3] next goal: cassava (dependency of criterion)
[__3] rejecting: cassava-0.5.2.0 (cyclic dependencies; conflict set:
attoparsec, cassava, criterion)
[__3] rejecting: cassava-0.5.1.0 (conflict: attoparsec==0.14.3, cassava =>
attoparsec>=0.11.3.0 && <0.14)
[__3] skipping: cassava-0.5.0.0, cassava-0.4.5.1, cassava-0.4.5.0,
cassava-0.4.4.0, cassava-0.4.3.1, cassava-0.4.3.0, cassava-0.4.2.4,
cassava-0.4.2.3, cassava-0.4.2.2, cassava-0.4.2.1, cassava-0.4.2.0,
cassava-0.4.1.0, cassava-0.4.0.0, cassava-0.3.0.1, cassava-0.3.0.0,
cassava-0.2.2.0, cassava-0.2.1.2, cassava-0.2.1.1, cassava-0.2.1.0,
cassava-0.2.0.0, cassava-0.1.0.1, cassava-0.1.0.0 (has the same
characteristics that caused the previous version to fail: excludes
'attoparsec' version 0.14.3)
[__3] fail (backjumping, conflict set: attoparsec, cassava, criterion)

There is also a stray attoparsec-benchmarks.cabal, but no cabal.project to refer it. Benchmarks are not built on CI, which exposes us to risk of breaking them without any notice.

This PR modernizes project's structure, introducing an internal library for things, which we wish to test and benchmark, but not to expose to end users, + switching from criterion to tasty-bench. Benchmarks are now built on CI.

CC @bgamari

@KovalevDima benchmarks should simply work now.

Bodigrim commented 2 years ago

I cannot reproduce GHC 8.2.2 build failure (segmentation fault?) locally, and it is unlikely related to this PR.

Bodigrim commented 2 years ago

OK, got it. That was actually a pretty nasty segmentation fault with text-2.0, and I do not understand why I have not seen it before.

KovalevDima commented 2 years ago

Bechmarks were built from scratch with this changes

Bodigrim commented 2 years ago

Alright, I distilled a test case which deterministically triggers a segmentation fault. It appears that otherwise QuickCheck rarely generates an offending combination. Plus extended CI matrix to run builds against text-2.0. This is ready for review, @bgamari.

bgamari commented 2 years ago

Thank you, @Bodigrim!

bgamari commented 2 years ago

Released as 0.14.4.