containers icon indicating copy to clipboard operation
containers copied to clipboard

Larger keys for intmap and intset

Open jwaldmann opened this issue 3 years ago • 15 comments

as discussed in https://github.com/haskell/containers/issues/788 .

I have no idea on how to best pass the "-a N" option for testing. Does it go in haskell-ci.yml, or in cabal.haskell-ci? or in containers.cabal?

or in the source? That seems easiest to do, and most stable (independent from build/CI tooling) but it would ignore command-line options, which is bad? https://hackage.haskell.org/package/test-framework-0.8.2.0/docs/Test-Framework-Runners-Console.html#v:defaultMainWithArgs

Adding --test-option="-a 10000" does seem to increase CI build times - quite drastically. Or, they weren't very stable to begin with.

jwaldmann avatar Jul 22 '21 16:07 jwaldmann

I have no idea on how to best pass the "-a N" option for testing. Does it go in haskell-ci.yml, or in cabal.haskell-ci? or in containers.cabal?

or in the source? That seems easiest to do, and most stable (independent from build/CI tooling) but it would ignore command-line options, which is bad? https://hackage.haskell.org/package/test-framework-0.8.2.0/docs/Test-Framework-Runners-Console.html#v:defaultMainWithArgs

So in dhall's testsuite we have a little helper that we use to specify the number of QuickCheck tests in the code, but that can still be overriden on the CLI with a higher number of tests:

https://github.com/dhall-lang/dhall-haskell/blob/8aed63714def462056847f685f5871d74c12b6cf/dhall/tests/Dhall/Test/QuickCheck.hs#L787-L791

We're using tasty though – I don't know whether something similar can be achieved with test-framework.

Since test-framework is basically unmaintained, and since tasty's API has a large overlap with test-framework, maybe we should migrate to tasty anyway?

sjakobi avatar Jul 30 '21 14:07 sjakobi

Migration to tasty usually boils down to renaming imports and wrapping top-level tests in testGroup “All”. The sooner we leave test-framework in the past, the better.

Bodigrim avatar Jul 30 '21 18:07 Bodigrim

@treeowl How do you feel about migrating to tasty?

sjakobi avatar Aug 05 '21 15:08 sjakobi

I know nothing about test frameworks, so I'm very happy to let other people decide.

On Thu, Aug 5, 2021 at 11:45 AM Simon Jakobi @.***> wrote:

@treeowl https://github.com/treeowl How do you feel about migrating to tasty?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/haskell/containers/pull/790#issuecomment-893564438, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOOF7M3ODBK73O3NMNFTSDT3KW2PANCNFSM5A2K3OXA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

treeowl avatar Aug 05 '21 17:08 treeowl

Oh yeah, this discussion. Someone came up with something pretty decent (I think) for my little toy compact-sequences package. Does that look like something we could reasonably copy, or is it not up to the challenge of a big test suite?

treeowl avatar Aug 17 '21 17:08 treeowl

Now that I've merged #796, can you do what you want with test case sizes here? Ideally, I like to run tests three ways:

  1. Many small cases.
  2. A moderate number of moderately sized cases.
  3. A small number of large cases.

The three ways should be tweaked to run in the same amount of time (give or take an order of magnitude or so). This should be almost as good as SmallCheck for the small cases, but also be likely to catch glaring mistakes in large ones.

treeowl avatar Aug 17 '21 21:08 treeowl

I'd feel more comfortable about this if we tested with multiple sizes. See https://github.com/treeowl/compact-sequences/commit/585bfac95611b30cf060a4c04ade9f2ee19fa3ed for a commit doing so elsewhere.

treeowl avatar Mar 11 '22 20:03 treeowl

tested with multiple sizes

OK, I'll look into this.

Just for calibration, this (on my local machine)

time cabal test all --test-show-details=direct --test-options="--quickcheck-tests 1000 --quickcheck-max-size 100"

real    0m20.246s
user    1m18.343s
sys     0m4.309s

is about 3 min on CI.

Runtime does increase strongly with max-size.

jwaldmann avatar Mar 11 '22 20:03 jwaldmann

now the test run takes 25 min in CI (for each ghc version). that's too much?

jwaldmann avatar Mar 11 '22 21:03 jwaldmann

Ouch. Yeah, that seems excessive. Did you limit that to just IntMap and IntSet?

treeowl avatar Mar 11 '22 21:03 treeowl

no, I applied globally. https://github.com/jwaldmann/containers/commit/3a3929dff0b32707e226adb6cb17efdeb644e698

In theory, your method (lots of small, some large, etc.) should be fine for all tests?

jwaldmann avatar Mar 11 '22 22:03 jwaldmann

Yeah, it should work, but it's pricy. IntMap and IntSet seem much more likely than the other structures to exhibit special behavior around size extremes.

treeowl avatar Mar 11 '22 22:03 treeowl

I did restrict the test sets that get larger parameters. It's still expensive, and the programming gets ugly. I am not an expert at tasty's not-quite-regexps, and CI's not-quite-bash.

OTOH, perhaps 20 min (per GHC version) isn't too bad. If it catches bugs? The contributor can run faster tests locally. The maintainer needs days to accept the PR, anyway. Which is fine. (Though, a more clever CI would use that waiting time to run extra tests ... or even write some...)

jwaldmann avatar Mar 12 '22 02:03 jwaldmann

Looking over the conversation, it's not clear whether everything is resolved. Could you possibly update?

treeowl avatar Jan 21 '23 18:01 treeowl

I'm on it (just did a rebase).

I wanted to take up #787 again. I was benchmarking NFA-DFA conversion with several Map IntSet foo implementations (hint: HashMap wins, Data.Map seems close, but only with the non-allocation Ord instance. I think.)

[EDIT] see https://gitlab.imn.htwk-leipzig.de/waldmann/fdaln/-/blob/master/DFA.hs

jwaldmann avatar Jan 21 '23 19:01 jwaldmann