diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 96324df..e05788b 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -1,6 +1,6 @@ # This GitHub workflow config has been generated by a script via # -# haskell-ci 'github' 'cabal.project' +# haskell-ci 'github' 'park-bench.cabal' # # To regenerate the script (for example after adjusting tested-with) run # @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.15.20230312 +# version: 0.17.20231010 # -# REGENDATA ("0.15.20230312",["github","cabal.project"]) +# REGENDATA ("0.17.20231010",["github","park-bench.cabal"]) # name: Haskell-CI on: @@ -28,19 +28,19 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.6.1 + - compiler: ghc-9.8.1 compilerKind: ghc - compilerVersion: 9.6.1 + compilerVersion: 9.8.1 setup-method: ghcup allow-failure: false - - compiler: ghc-9.4.4 + - compiler: ghc-9.6.3 compilerKind: ghc - compilerVersion: 9.4.4 + compilerVersion: 9.6.3 setup-method: ghcup allow-failure: false - - compiler: ghc-9.2.7 + - compiler: ghc-9.4.7 compilerKind: ghc - compilerVersion: 9.2.7 + compilerVersion: 9.4.7 setup-method: ghcup allow-failure: false fail-fast: false @@ -50,7 +50,7 @@ jobs: apt-get update apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) "$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) @@ -65,10 +65,12 @@ jobs: echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" HCDIR=/opt/$HCKIND/$HCVER - HC=$HOME/.ghcup/bin/$HCKIND-$HCVER + HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") + HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') + HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') echo "HC=$HC" >> "$GITHUB_ENV" - echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV" - echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV" + echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" + echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" @@ -119,8 +121,8 @@ jobs: - name: install cabal-plan run: | mkdir -p $HOME/.cabal/bin - curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > cabal-plan.xz - echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c - + curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.7.3.0/cabal-plan-0.7.3.0-x86_64-linux.xz > cabal-plan.xz + echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c - xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan rm -f cabal-plan.xz chmod a+x $HOME/.cabal/bin/cabal-plan @@ -132,8 +134,7 @@ jobs: - name: initial cabal.project for sdist run: | touch cabal.project - echo "packages: $GITHUB_WORKSPACE/source/park-bench" >> cabal.project - echo "packages: $GITHUB_WORKSPACE/source/park-bench-internal" >> cabal.project + echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project cat cabal.project - name: sdist run: | @@ -147,20 +148,15 @@ jobs: run: | PKGDIR_park_bench="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/park-bench-[0-9.]*')" echo "PKGDIR_park_bench=${PKGDIR_park_bench}" >> "$GITHUB_ENV" - PKGDIR_park_bench_internal="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/park-bench-internal-[0-9.]*')" - echo "PKGDIR_park_bench_internal=${PKGDIR_park_bench_internal}" >> "$GITHUB_ENV" rm -f cabal.project cabal.project.local touch cabal.project touch cabal.project.local echo "packages: ${PKGDIR_park_bench}" >> cabal.project - echo "packages: ${PKGDIR_park_bench_internal}" >> cabal.project echo "package park-bench" >> cabal.project echo " ghc-options: -Werror=missing-methods" >> cabal.project - echo "package park-bench-internal" >> cabal.project - echo " ghc-options: -Werror=missing-methods" >> cabal.project cat >> cabal.project <> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(park-bench)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan @@ -187,8 +183,6 @@ jobs: run: | cd ${PKGDIR_park_bench} || false ${CABAL} -vnormal check - cd ${PKGDIR_park_bench_internal} || false - ${CABAL} -vnormal check - name: haddock run: | $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all diff --git a/park-bench/CHANGELOG.md b/CHANGELOG.md similarity index 67% rename from park-bench/CHANGELOG.md rename to CHANGELOG.md index 5bf2142..a938d27 100644 --- a/park-bench/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,6 @@ -## [0.1.1.0] - Unreleased +## [0.1.1.0] - 23-10-10 - Accept `PARK_BENCH_RUNLEN` env var -- Move `ParkBench.Internal` into its own package `park-bench-internal` ## [0.1.0.1] - 22-08-06 diff --git a/park-bench/LICENSE b/LICENSE similarity index 96% rename from park-bench/LICENSE rename to LICENSE index ecc17c7..7fde929 100644 --- a/park-bench/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2020-2022 Mitchell Rosen, Travis Staton +Copyright 2020-2023 Mitchell Rosen, Travis Staton Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/README.md b/README.md deleted file mode 120000 index 1b79f7a..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -park-bench/README.md \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..3e96f71 --- /dev/null +++ b/README.md @@ -0,0 +1,111 @@ +[![GitHub CI](https://github.com/awkward-squad/park-bench/workflows/Haskell-CI/badge.svg)](https://github.com/awkward-squad/park-bench/actions?query=workflow%3AHaskell-CI) | +[![Hackage](https://img.shields.io/hackage/v/park-bench.svg?label=park-bench&logo=haskell)](https://hackage.haskell.org/package/park-bench) +[![Stackage LTS](https://stackage.org/package/park-bench/badge/lts)](https://www.stackage.org/lts/package/park-bench) +[![Stackage Nightly](https://stackage.org/package/park-bench/badge/nightly)](https://www.stackage.org/nightly/package/park-bench) +[![Dependencies](https://img.shields.io/hackage-deps/v/park-bench)](https://packdeps.haskellers.com/reverse/park-bench) + +# Overview + +`park-bench` is a quick-and-dirty benchmarking tool for comparing the performance of Haskell functions. Specifically, it +is designed to optimize the workflow in which a programmer makes a small change to a function and wants to measure its +performance impact with as little friction as possible. + +![Screenshot](https://github.com/awkward-squad/park-bench/blob/main/images/screenshot.png?raw=true) + +# Configuration + +| Environment variable name | Type | Meaning | Default value | +| --- | --- | --- | --- | +| `PARK_BENCH_RUNLEN` | Float | The target number of seconds that each benchmark run takes | `0.1` | + +# Example usage + +Say I am interested in improving the performance of `fib`, which is a function defined in module `MyMathUtilities.Fib` +in a local package called `my-math-utilities`. + +## Step 1: Write the function you'd like to benchmark + +First, I'm going to copy the implementation of `fib` to a new top-level definition called `fastfib`, tweak its +implementation, and export both from module `MyMathUtilities.Fib`. + +If `fib` was private before, that's ok. We only need to expose it for as long as we are interested in benchmarking. + +```haskell +module MyMathUtilities.Fib (fib, fastfib, ...) where +``` + +## Step 2: Write a standalone `bench/Main.hs` module with a `main` function + +Next, I'm going to write a standalone `Main.hs` in a subdirectory called `bench`, which will be compiled to an +executable that runs my benchmark. + +```haskell +module Main where + +-- The module in my local package that I want to benchmark +import MyMathUtilities.Fib + +-- This library +import ParkBench + +main :: IO () +main = + benchmark + [ function "fib" fib 20 + , function "fastfib" fastfib 20 + ] +``` + +## Step 3: Define an executable component + +Next, I'm going to define an executable component for my benchmark in my `my-math-utilities.cabal` file. + +```cabal +executable bench + build-depends: + base, + -- The local package that I want to benchmark + my-math-utilities, + -- This library + park-bench + default-language: Haskell2010 + ghc-options: -O -rtsopts -with-rtsopts=-T + hs-source-dirs: bench + main-is: Main.hs +``` + +I need to compile the benchmark with `-rtsopts -with-rtsopts=-T`, otherwise my benchmark will not be able to get RTS +statistics from GHC at runtime. + +Alternatively, I could compile the benchmark with only `-rtsopts`, but then I'll have to provide `+RTS -T` to the +executable later. + +## Step 4: Run the benchmark + +If all goes well, I'll have an executable component to run. + +``` +cabal run my-math-utilities:exe:bench +``` +``` +stack run my-math-utilities:exe:bench +``` + +Or, if I only compiled with `-rtsopts`, but not `-with-rtsopts=-T`, + +``` +cabal run my-math-utilities:exe:bench -- +RTS -T +``` +``` +stack run my-math-utilities:exe:bench -- +RTS -T +``` + +## Step 5: Clean up + +After benchmarking, I can choose to keep the benchmark (and associated executable component) around, but I'll probably +delete them instead. I've learned something, collected some sweet screenshots for my PR, and I'm ready to move on. + +# Caveat emptor + +The statistical analysis performed by `park-bench` is simplistic, written by a novice, and may have bugs. Results should +not necessarily be trusted; please use (or at least compare to) a different tool. diff --git a/cabal.project b/cabal.project deleted file mode 100644 index e48acbc..0000000 --- a/cabal.project +++ /dev/null @@ -1,3 +0,0 @@ -packages: - park-bench - park-bench-internal diff --git a/park-bench/images/screenshot.png b/images/screenshot.png similarity index 100% rename from park-bench/images/screenshot.png rename to images/screenshot.png diff --git a/park-bench-internal/CHANGELOG.md b/park-bench-internal/CHANGELOG.md deleted file mode 100644 index df97a2a..0000000 --- a/park-bench-internal/CHANGELOG.md +++ /dev/null @@ -1,3 +0,0 @@ -## [0.1.0] - Unreleased - -- Initial release. diff --git a/park-bench-internal/LICENSE b/park-bench-internal/LICENSE deleted file mode 100644 index ecc17c7..0000000 --- a/park-bench-internal/LICENSE +++ /dev/null @@ -1,11 +0,0 @@ -Copyright 2020-2022 Mitchell Rosen, Travis Staton - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/park-bench-internal/park-bench-internal.cabal b/park-bench.cabal similarity index 78% rename from park-bench-internal/park-bench-internal.cabal rename to park-bench.cabal index d7c6651..cc604b3 100644 --- a/park-bench-internal/park-bench-internal.cabal +++ b/park-bench.cabal @@ -3,22 +3,26 @@ cabal-version: 2.2 author: Mitchell Rosen, Travis Staton bug-reports: https://github.com/awkward-squad/park-bench/issues category: Benchmarking -copyright: Copyright (C) 2020-2022 Mitchell Rosen, Travis Staton +copyright: Copyright (C) 2020-2023 Mitchell Rosen, Travis Staton homepage: https://github.com/awkward-squad/park-bench license: BSD-3-Clause license-file: LICENSE maintainer: Mitchell Rosen , Travis Staton -name: park-bench-internal +name: park-bench stability: experimental -synopsis: @park-bench@ internals -tested-with: GHC == 9.2.7, GHC == 9.4.4, GHC == 9.6.1 -version: 0.1.0 +synopsis: A quick-and-dirty, low-friction benchmark tool with immediate feedback +tested-with: GHC == 9.4.7, GHC == 9.6.3, GHC == 9.8.1 +version: 0.1.1.0 description: - @park-bench@ internals. + A quick-and-dirty, low-friction benchmark tool with immediate feedback. + +extra-doc-files: + images/*.png extra-source-files: CHANGELOG.md + README.md source-repository head type: git @@ -27,10 +31,10 @@ source-repository head library build-depends: array ^>= 0.5, - base ^>= 4.12 || ^>= 4.13 || ^>= 4.14 || ^>= 4.15 || ^>= 4.16 || ^>= 4.17 || ^>= 4.18, - bytestring ^>= 0.10 || ^>= 0.11, - ghc-prim ^>= 0.3 || ^>= 0.4 || ^>= 0.5 || ^>= 0.6 || ^>= 0.7 || ^>= 0.8 || ^>= 0.9 || ^>= 0.10, - text ^>= 1.1 || ^>= 1.2 || ^>= 2.0, + base ^>= 4.12 || ^>= 4.13 || ^>= 4.14 || ^>= 4.15 || ^>= 4.16 || ^>= 4.17 || ^>= 4.18 || ^>= 4.19, + bytestring ^>= 0.10 || ^>= 0.11 || ^>= 0.12, + ghc-prim ^>= 0.3 || ^>= 0.4 || ^>= 0.5 || ^>= 0.6 || ^>= 0.7 || ^>= 0.8 || ^>= 0.9 || ^>= 0.10 || ^>= 0.11, + text ^>= 1.1 || ^>= 1.2 || ^>= 2.0 || ^>= 2.1, default-extensions: AllowAmbiguousTypes BangPatterns @@ -64,19 +68,7 @@ library ViewPatterns default-language: Haskell2010 exposed-modules: - ParkBench.Internal.Array1 - ParkBench.Internal.Benchable - ParkBench.Internal.Builder - ParkBench.Internal.Config - ParkBench.Internal.Driver - ParkBench.Internal.Measure - ParkBench.Internal.Named - ParkBench.Internal.Prelude - ParkBench.Internal.Pretty - ParkBench.Internal.Render - ParkBench.Internal.RtsStats - ParkBench.Internal.Statistics - ParkBench.Internal.Terminal + ParkBench ghc-options: -Weverything -Wno-all-missed-specialisations @@ -92,6 +84,22 @@ library if impl(ghc >= 9.2) ghc-options: -Wno-missing-kind-signatures + if impl(ghc >= 9.8) + ghc-options: + -Wno-missing-role-annotations hs-source-dirs: src other-modules: + ParkBench.Internal.Array1 + ParkBench.Internal.Benchable ParkBench.Internal.Benchable.Internal + ParkBench.Internal.Builder + ParkBench.Internal.Config + ParkBench.Internal.Driver + ParkBench.Internal.Measure + ParkBench.Internal.Named + ParkBench.Internal.Prelude + ParkBench.Internal.Pretty + ParkBench.Internal.Render + ParkBench.Internal.RtsStats + ParkBench.Internal.Statistics + ParkBench.Internal.Terminal diff --git a/park-bench/README.md b/park-bench/README.md deleted file mode 100644 index c3e4138..0000000 --- a/park-bench/README.md +++ /dev/null @@ -1,113 +0,0 @@ -| `park-bench` | `park-bench-internal` | -| --- | --- | -| [![GitHub CI](https://github.com/awkward-squad/park-bench/workflows/Haskell-CI/badge.svg)](https://github.com/awkward-squad/park-bench/actions?query=workflow%3AHaskell-CI) | | -| [![Hackage](https://img.shields.io/hackage/v/park-bench.svg?label=park-bench&logo=haskell)](https://hackage.haskell.org/package/park-bench) | [![Hackage](https://img.shields.io/hackage/v/park-bench-internal.svg?label=park-bench-internal&logo=haskell)](https://hackage.haskell.org/package/park-bench-internal) | -| [![Stackage LTS](https://stackage.org/package/park-bench/badge/lts)](https://www.stackage.org/lts/package/park-bench) | [![Stackage LTS](https://stackage.org/package/park-bench-internal/badge/lts)](https://www.stackage.org/lts/package/park-bench-internal) | -| [![Stackage Nightly](https://stackage.org/package/park-bench/badge/nightly)](https://www.stackage.org/nightly/package/park-bench) | [![Stackage Nightly](https://stackage.org/package/park-bench-internal/badge/nightly)](https://www.stackage.org/nightly/package/park-bench-internal) | -| [![Dependencies](https://img.shields.io/hackage-deps/v/park-bench)](https://packdeps.haskellers.com/reverse/park-bench) | [![Dependencies](https://img.shields.io/hackage-deps/v/park-bench-internal)](https://packdeps.haskellers.com/reverse/park-bench-internal) | - -# Overview - -`park-bench` is a quick-and-dirty benchmarking tool for comparing the performance of Haskell functions. Specifically, it -is designed to optimize the workflow in which a programmer makes a small change to a function and wants to measure its -performance impact with as little friction as possible. - -![Screenshot](https://github.com/awkward-squad/park-bench/blob/main/park-bench/images/screenshot.png?raw=true) - -# Configuration - -| Environment variable name | Type | Meaning | Default value | -| --- | --- | --- | --- | -| `PARK_BENCH_RUNLEN` | Float | The target number of seconds that each benchmark run takes | `0.1` | - -# Example usage - -Say I am interested in improving the performance of `fib`, which is a function defined in module `MyMathUtilities.Fib` -in a local package called `my-math-utilities`. - -## Step 1: Write the function you'd like to benchmark - -First, I'm going to copy the implementation of `fib` to a new top-level definition called `fastfib`, tweak its -implementation, and export both from module `MyMathUtilities.Fib`. - -If `fib` was private before, that's ok. We only need to expose it for as long as we are interested in benchmarking. - -```haskell -module MyMathUtilities.Fib (fib, fastfib, ...) where -``` - -## Step 2: Write a standalone `bench/Main.hs` module with a `main` function - -Next, I'm going to write a standalone `Main.hs` in a subdirectory called `bench`, which will be compiled to an -executable that runs my benchmark. - -```haskell -module Main where - --- The module in my local package that I want to benchmark -import MyMathUtilities.Fib - --- This library -import ParkBench - -main :: IO () -main = - benchmark - [ function "fib" fib 20 - , function "fastfib" fastfib 20 - ] -``` - -## Step 3: Define an executable component - -Next, I'm going to define an executable component for my benchmark in my `my-math-utilities.cabal` file. - -```cabal -executable bench - build-depends: - base, - -- The local package that I want to benchmark - my-math-utilities, - -- This library - park-bench - default-language: Haskell2010 - ghc-options: -O -rtsopts -with-rtsopts=-T - hs-source-dirs: bench - main-is: Main.hs -``` - -I need to compile the benchmark with `-rtsopts -with-rtsopts=-T`, otherwise my benchmark will not be able to get RTS -statistics from GHC at runtime. - -Alternatively, I could compile the benchmark with only `-rtsopts`, but then I'll have to provide `+RTS -T` to the -executable later. - -## Step 4: Run the benchmark - -If all goes well, I'll have an executable component to run. - -``` -cabal run my-math-utilities:exe:bench -``` -``` -stack run my-math-utilities:exe:bench -``` - -Or, if I only compiled with `-rtsopts`, but not `-with-rtsopts=-T`, - -``` -cabal run my-math-utilities:exe:bench -- +RTS -T -``` -``` -stack run my-math-utilities:exe:bench -- +RTS -T -``` - -## Step 5: Clean up - -After benchmarking, I can choose to keep the benchmark (and associated executable component) around, but I'll probably -delete them instead. I've learned something, collected some sweet screenshots for my PR, and I'm ready to move on. - -# Caveat emptor - -The statistical analysis performed by `park-bench` is simplistic, written by a novice, and may have bugs. Results should -not necessarily be trusted; please use (or at least compare to) a different tool. diff --git a/park-bench/park-bench.cabal b/park-bench/park-bench.cabal deleted file mode 100644 index 787fae7..0000000 --- a/park-bench/park-bench.cabal +++ /dev/null @@ -1,85 +0,0 @@ -cabal-version: 2.2 - -author: Mitchell Rosen, Travis Staton -bug-reports: https://github.com/awkward-squad/park-bench/issues -category: Benchmarking -copyright: Copyright (C) 2020-2022 Mitchell Rosen, Travis Staton -homepage: https://github.com/awkward-squad/park-bench -license: BSD-3-Clause -license-file: LICENSE -maintainer: Mitchell Rosen , Travis Staton -name: park-bench -stability: experimental -synopsis: A quick-and-dirty, low-friction benchmark tool with immediate feedback -tested-with: GHC == 9.2.7, GHC == 9.4.4, GHC == 9.6.1 -version: 0.1.1.0 - -description: - A quick-and-dirty, low-friction benchmark tool with immediate feedback. - -extra-doc-files: - images/*.png - -extra-source-files: - CHANGELOG.md - README.md - -source-repository head - type: git - location: https://github.com/awkward-squad/park-bench - -library - build-depends: - base ^>= 4.12 || ^>= 4.13 || ^>= 4.14 || ^>= 4.15 || ^>= 4.16 || ^>= 4.17 || ^>= 4.18, - park-bench-internal ^>= 0.1, - text ^>= 1.1 || ^>= 1.2 || ^>= 2.0, - default-extensions: - AllowAmbiguousTypes - BangPatterns - BlockArguments - ConstraintKinds - DeriveAnyClass - DeriveDataTypeable - DeriveFunctor - DeriveGeneric - DeriveTraversable - DerivingStrategies - DerivingVia - DuplicateRecordFields - ExistentialQuantification - FlexibleInstances - GeneralizedNewtypeDeriving - InstanceSigs - LambdaCase - OverloadedStrings - NamedFieldPuns - NoImplicitPrelude - NumericUnderscores - PartialTypeSignatures - PatternSynonyms - RankNTypes - RoleAnnotations - ScopedTypeVariables - TupleSections - TypeApplications - TypeSynonymInstances - ViewPatterns - default-language: Haskell2010 - exposed-modules: - ParkBench - ghc-options: - -Weverything - -Wno-all-missed-specialisations - -Wno-implicit-prelude - -Wno-missed-specialisations - -Wno-missing-import-lists - -Wno-safe - -Wno-unsafe - if impl(ghc >= 8.10) - ghc-options: - -Wno-missing-safe-haskell-mode - -Wno-prepositive-qualified-module - if impl(ghc >= 9.2) - ghc-options: - -Wno-missing-kind-signatures - hs-source-dirs: src diff --git a/park-bench/src/ParkBench.hs b/src/ParkBench.hs similarity index 100% rename from park-bench/src/ParkBench.hs rename to src/ParkBench.hs diff --git a/park-bench-internal/src/ParkBench/Internal/Array1.hs b/src/ParkBench/Internal/Array1.hs similarity index 100% rename from park-bench-internal/src/ParkBench/Internal/Array1.hs rename to src/ParkBench/Internal/Array1.hs diff --git a/park-bench-internal/src/ParkBench/Internal/Benchable.hs b/src/ParkBench/Internal/Benchable.hs similarity index 100% rename from park-bench-internal/src/ParkBench/Internal/Benchable.hs rename to src/ParkBench/Internal/Benchable.hs diff --git a/park-bench-internal/src/ParkBench/Internal/Benchable/Internal.hs b/src/ParkBench/Internal/Benchable/Internal.hs similarity index 100% rename from park-bench-internal/src/ParkBench/Internal/Benchable/Internal.hs rename to src/ParkBench/Internal/Benchable/Internal.hs diff --git a/park-bench-internal/src/ParkBench/Internal/Builder.hs b/src/ParkBench/Internal/Builder.hs similarity index 100% rename from park-bench-internal/src/ParkBench/Internal/Builder.hs rename to src/ParkBench/Internal/Builder.hs diff --git a/park-bench-internal/src/ParkBench/Internal/Config.hs b/src/ParkBench/Internal/Config.hs similarity index 100% rename from park-bench-internal/src/ParkBench/Internal/Config.hs rename to src/ParkBench/Internal/Config.hs diff --git a/park-bench-internal/src/ParkBench/Internal/Driver.hs b/src/ParkBench/Internal/Driver.hs similarity index 100% rename from park-bench-internal/src/ParkBench/Internal/Driver.hs rename to src/ParkBench/Internal/Driver.hs diff --git a/park-bench-internal/src/ParkBench/Internal/Measure.hs b/src/ParkBench/Internal/Measure.hs similarity index 100% rename from park-bench-internal/src/ParkBench/Internal/Measure.hs rename to src/ParkBench/Internal/Measure.hs diff --git a/park-bench-internal/src/ParkBench/Internal/Named.hs b/src/ParkBench/Internal/Named.hs similarity index 100% rename from park-bench-internal/src/ParkBench/Internal/Named.hs rename to src/ParkBench/Internal/Named.hs diff --git a/park-bench-internal/src/ParkBench/Internal/Prelude.hs b/src/ParkBench/Internal/Prelude.hs similarity index 58% rename from park-bench-internal/src/ParkBench/Internal/Prelude.hs rename to src/ParkBench/Internal/Prelude.hs index 1ecfa0e..f7202ff 100644 --- a/park-bench-internal/src/ParkBench/Internal/Prelude.hs +++ b/src/ParkBench/Internal/Prelude.hs @@ -10,8 +10,7 @@ module ParkBench.Internal.Prelude ) where -import Control.Applicative as X -import Control.Monad as X +import Control.Monad as X (forever) import Data.Coerce as X (coerce) import Data.Foldable as X (fold, foldl') import Data.Functor as X (($>)) @@ -21,7 +20,55 @@ import Data.Typeable as X (Typeable) import Data.Word as X (Word64, Word8) import GHC.Generics as X (Generic) import Numeric.Natural as X (Natural) -import Prelude as X hiding (read) +import Prelude as X + ( Applicative (..), + Bool (..), + Char, + Double, + Eq (..), + FilePath, + Foldable, + Functor (..), + IO, + Int, + Maybe (..), + Monad (..), + Monoid (..), + Num (..), + Ord (..), + Ordering (..), + Rational, + Semigroup (..), + Show (..), + String, + Traversable, + all, + error, + floor, + foldMap, + fromIntegral, + fromRational, + length, + map, + max, + maxBound, + otherwise, + realToFrac, + replicate, + sqrt, + subtract, + toRational, + traverse, + undefined, + zip, + zipWith, + ($!), + (++), + (.), + (/), + (<$>), + (||), + ) divide :: Rational -> Rational -> Rational divide n d = diff --git a/park-bench-internal/src/ParkBench/Internal/Pretty.hs b/src/ParkBench/Internal/Pretty.hs similarity index 94% rename from park-bench-internal/src/ParkBench/Internal/Pretty.hs rename to src/ParkBench/Internal/Pretty.hs index 36405a6..e468eaf 100644 --- a/park-bench-internal/src/ParkBench/Internal/Pretty.hs +++ b/src/ParkBench/Internal/Pretty.hs @@ -257,13 +257,16 @@ renderTable (Table labels rowGroups) = s -> Just ((line : s) `Builder.sepBy` Builder.char '\n') where line = - Builder.char '├' - <> "\ESC[1m\ESC[97m" - <> Builder.text (Text.map dash label) - <> "\ESC[39m\ESC[22m" - <> Builder.chars (head widths + 2 - Text.length label) '─' - <> foldMap (\n -> Builder.char '┼' <> Builder.chars (n + 2) '─') (tail widths) - <> Builder.char '┤' + case widths of + w0 : ws -> + Builder.char '├' + <> "\ESC[1m\ESC[97m" + <> Builder.text (Text.map dash label) + <> "\ESC[39m\ESC[22m" + <> Builder.chars (w0 + 2 - Text.length label) '─' + <> foldMap (\n -> Builder.char '┼' <> Builder.chars (n + 2) '─') ws + <> Builder.char '┤' + _ -> undefined dash :: Char -> Char dash = \case diff --git a/park-bench-internal/src/ParkBench/Internal/Render.hs b/src/ParkBench/Internal/Render.hs similarity index 100% rename from park-bench-internal/src/ParkBench/Internal/Render.hs rename to src/ParkBench/Internal/Render.hs diff --git a/park-bench-internal/src/ParkBench/Internal/RtsStats.hs b/src/ParkBench/Internal/RtsStats.hs similarity index 100% rename from park-bench-internal/src/ParkBench/Internal/RtsStats.hs rename to src/ParkBench/Internal/RtsStats.hs diff --git a/park-bench-internal/src/ParkBench/Internal/Statistics.hs b/src/ParkBench/Internal/Statistics.hs similarity index 100% rename from park-bench-internal/src/ParkBench/Internal/Statistics.hs rename to src/ParkBench/Internal/Statistics.hs diff --git a/park-bench-internal/src/ParkBench/Internal/Terminal.hs b/src/ParkBench/Internal/Terminal.hs similarity index 100% rename from park-bench-internal/src/ParkBench/Internal/Terminal.hs rename to src/ParkBench/Internal/Terminal.hs