From d477df03b42fdb1abc32beb35fe7971a324f80f1 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 17 Dec 2020 23:39:22 -0800 Subject: Makefile: remove macospkg target. Now we just download the artifacts from CircleCI, and make. --- Makefile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index ce17c0a15..e82a0e449 100644 --- a/Makefile +++ b/Makefile @@ -76,11 +76,6 @@ debpkg: man/pandoc.1 utdemir/ghc-musl:v12-libgmp-ghc8101 bash \ /mnt/linux/make_artifacts.sh -macospkg: - rm -rf macos-release-candidate - aws s3 sync s3://travis-jgm-pandoc macos-release-candidate - make -C macos-release-candidate - man/pandoc.1: MANUAL.txt man/pandoc.1.before man/pandoc.1.after pandoc $< -f markdown -t man -s \ --lua-filter man/manfilter.lua \ @@ -117,4 +112,4 @@ update-website: clean: stack clean -.PHONY: deps quick full haddock install clean test bench changes_github macospkg dist prof download_stats reformat lint weigh doc/lua-filters.md pandoc-templates trypandoc update-website debpkg macospkg checkdocs ghcid ghci fix_spacing hlint +.PHONY: deps quick full haddock install clean test bench changes_github dist prof download_stats reformat lint weigh doc/lua-filters.md pandoc-templates trypandoc update-website debpkg checkdocs ghcid ghci fix_spacing hlint -- cgit v1.2.3 From c8c8c8b24ce51805795e975e3b143c538d7f1a8e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 18 Dec 2020 09:18:51 -0800 Subject: Add check and check-cabal target ... to check to make sure everything needed in tests will get into the source sdist. --- Makefile | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e82a0e449..4749d2f3f 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,9 @@ dist: man/pandoc.1 cd pandoc-${version} stack setup && stack test && cd .. && rm -rf "pandoc-${version}" -checkdocs: README.md +check: checkdocs check-cabal + +checkdocs: ! grep -n -e "\t" MANUAL.txt changelog debpkg: man/pandoc.1 @@ -112,4 +114,14 @@ update-website: clean: stack clean -.PHONY: deps quick full haddock install clean test bench changes_github dist prof download_stats reformat lint weigh doc/lua-filters.md pandoc-templates trypandoc update-website debpkg checkdocs ghcid ghci fix_spacing hlint +check-cabal: git-test-files.txt sdist-test-files.txt + echo "Checking to see if all committed test files are in sdist..." + diff -u $^ + +sdist-test-files.txt: .FORCE + cabal sdist --list-only | sed 's/\.\///' | grep '^test\/' | sort > $@ + +git-test-files.txt: .FORCE + git ls-tree -r --name-only HEAD | grep '^test\/' | sort > $@ + +.PHONY: .FORCE deps quick full haddock install clean test bench changes_github dist prof download_stats reformat lint weigh doc/lua-filters.md pandoc-templates trypandoc update-website debpkg checkdocs ghcid ghci fix_spacing hlint check check-cabal -- cgit v1.2.3 From 559b12ee3a2f741298c1a1ae063db6582c34370e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 18 Dec 2020 09:46:20 -0800 Subject: Makefile: Fix checkdocs target. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 4749d2f3f..07fc6c772 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ dist: man/pandoc.1 check: checkdocs check-cabal checkdocs: - ! grep -n -e "\t" MANUAL.txt changelog + ! grep -q -n -e "\t" MANUAL.txt changelog.md debpkg: man/pandoc.1 docker run -v `pwd`:/mnt \ -- cgit v1.2.3 From 757dbc637b475058905d13fdb89e7cf98f6a331a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 18 Dec 2020 12:04:24 -0800 Subject: Improve check target to test data/ too. --- .github/workflows/lint.yml | 7 +------ Makefile | 12 ++++++------ 2 files changed, 7 insertions(+), 12 deletions(-) (limited to 'Makefile') diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index da30f6c27..fb7d9d0b5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,12 +26,7 @@ jobs: uses: actions/checkout@v2 - name: Check cabal file for missing test files - run: | - cabal sdist --list-only | sed 's/\.\///' | grep '^test\/' | \ - sort > sdist-test-files.txt - git ls-tree -r --name-only HEAD | grep '^test\/' | \ - sort > git-test-files.txt - diff -u git-test-files.txt sdist-test-files.txt + run: make check-cabal - name: Download and run hlint run: | diff --git a/Makefile b/Makefile index 07fc6c772..f27272b08 100644 --- a/Makefile +++ b/Makefile @@ -114,14 +114,14 @@ update-website: clean: stack clean -check-cabal: git-test-files.txt sdist-test-files.txt - echo "Checking to see if all committed test files are in sdist..." +check-cabal: git-files.txt sdist-files.txt + echo "Checking to see if all committed test/data files are in sdist." diff -u $^ -sdist-test-files.txt: .FORCE - cabal sdist --list-only | sed 's/\.\///' | grep '^test\/' | sort > $@ +sdist-files.txt: .FORCE + cabal sdist --list-only | sed 's/\.\///' | grep '^\(test\|data\)\/' | sort > $@ -git-test-files.txt: .FORCE - git ls-tree -r --name-only HEAD | grep '^test\/' | sort > $@ +git-files.txt: .FORCE + git ls-tree -r --name-only HEAD | grep '^\(test\|data\)\/' | sort > $@ .PHONY: .FORCE deps quick full haddock install clean test bench changes_github dist prof download_stats reformat lint weigh doc/lua-filters.md pandoc-templates trypandoc update-website debpkg checkdocs ghcid ghci fix_spacing hlint check check-cabal -- cgit v1.2.3 From 91fbea29ddf961654b1c09efaba70d92bfd65cc0 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 12 Jan 2021 21:18:17 -0800 Subject: Add files for using nix-shell. 'make nix-shell' enters a nix shell with pandoc dependencies installed. --- Makefile | 8 +++++++- default.nix | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ release.nix | 4 ++++ 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 default.nix create mode 100644 release.nix (limited to 'Makefile') diff --git a/Makefile b/Makefile index f27272b08..e9607f198 100644 --- a/Makefile +++ b/Makefile @@ -91,6 +91,12 @@ README.md: README.template MANUAL.txt tools/update-readme.lua pandoc --lua-filter tools/update-readme.lua \ --reference-location=section -t gfm $< -o $@ +default.nix: pandoc.cabal + nix-shell --pure -p cabal2nix --run "cabal2nix ." > $@ + +nix-shell: + nix-shell --attr env release.nix + download_stats: curl https://api.github.com/repos/jgm/pandoc/releases | \ jq -r '.[] | .assets | .[] | "\(.download_count)\t\(.name)"' @@ -124,4 +130,4 @@ sdist-files.txt: .FORCE git-files.txt: .FORCE git ls-tree -r --name-only HEAD | grep '^\(test\|data\)\/' | sort > $@ -.PHONY: .FORCE deps quick full haddock install clean test bench changes_github dist prof download_stats reformat lint weigh doc/lua-filters.md pandoc-templates trypandoc update-website debpkg checkdocs ghcid ghci fix_spacing hlint check check-cabal +.PHONY: .FORCE deps quick full haddock install clean test bench changes_github dist prof download_stats reformat lint weigh doc/lua-filters.md pandoc-templates trypandoc update-website debpkg checkdocs ghcid ghci fix_spacing hlint check check-cabal nix-shell diff --git a/default.nix b/default.nix new file mode 100644 index 000000000..a18be1fa8 --- /dev/null +++ b/default.nix @@ -0,0 +1,55 @@ +{ mkDerivation, aeson, aeson-pretty, attoparsec, base +, base64-bytestring, binary, blaze-html, blaze-markup, bytestring +, case-insensitive, citeproc, commonmark, commonmark-extensions +, commonmark-pandoc, connection, containers, criterion +, data-default, deepseq, Diff, directory, doclayout, doctemplates +, emojis, exceptions, executable-path, file-embed, filepath, Glob +, haddock-library, hslua, hslua-module-system, hslua-module-text +, HsYAML, HTTP, http-client, http-client-tls, http-types, ipynb +, jira-wiki-markup, JuicyPixels, mtl, network, network-uri +, pandoc-types, parsec, process, QuickCheck, random, safe +, scientific, SHA, skylighting, skylighting-core, split, stdenv +, syb, tagsoup, tasty, tasty-golden, tasty-hunit, tasty-lua +, tasty-quickcheck, temporary, texmath, text, text-conversions +, time, unicode-transforms, unix, unordered-containers, weigh, xml +, zip-archive, zlib +}: +mkDerivation { + pname = "pandoc"; + version = "2.11.4"; + src = ./.; + configureFlags = [ "-fhttps" "-f-trypandoc" ]; + isLibrary = true; + isExecutable = true; + enableSeparateDataOutput = true; + libraryHaskellDepends = [ + aeson aeson-pretty attoparsec base base64-bytestring binary + blaze-html blaze-markup bytestring case-insensitive citeproc + commonmark commonmark-extensions commonmark-pandoc connection + containers data-default deepseq directory doclayout doctemplates + emojis exceptions file-embed filepath Glob haddock-library hslua + hslua-module-system hslua-module-text HsYAML HTTP http-client + http-client-tls http-types ipynb jira-wiki-markup JuicyPixels mtl + network network-uri pandoc-types parsec process random safe + scientific SHA skylighting skylighting-core split syb tagsoup + temporary texmath text text-conversions time unicode-transforms + unix unordered-containers xml zip-archive zlib + ]; + executableHaskellDepends = [ base ]; + testHaskellDepends = [ + base base64-bytestring bytestring containers Diff directory + doctemplates exceptions executable-path filepath Glob hslua mtl + pandoc-types process QuickCheck tasty tasty-golden tasty-hunit + tasty-lua tasty-quickcheck temporary text time xml zip-archive + ]; + benchmarkHaskellDepends = [ + base bytestring containers criterion mtl text time weigh + ]; + postInstall = '' + mkdir -p $out/share/man/man1 + mv "man/"*.1 $out/share/man/man1/ + ''; + homepage = "https://pandoc.org"; + description = "Conversion between markup formats"; + license = stdenv.lib.licenses.gpl2Plus; +} diff --git a/release.nix b/release.nix new file mode 100644 index 000000000..e28be9ac3 --- /dev/null +++ b/release.nix @@ -0,0 +1,4 @@ +let + pkgs = import { }; +in + pkgs.haskellPackages.callPackage ./default.nix { } -- cgit v1.2.3 From bd3b7c2e2c5ecb08c1ab3cd6c1176c883a124af3 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 12 Jan 2021 22:28:57 -0800 Subject: Delete default.nix. It is generated and shouldn't be in repository. --- Makefile | 2 +- default.nix | 55 ------------------------------------------------------- 2 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 default.nix (limited to 'Makefile') diff --git a/Makefile b/Makefile index e9607f198..1f7fd98b4 100644 --- a/Makefile +++ b/Makefile @@ -94,7 +94,7 @@ README.md: README.template MANUAL.txt tools/update-readme.lua default.nix: pandoc.cabal nix-shell --pure -p cabal2nix --run "cabal2nix ." > $@ -nix-shell: +nix-shell: default.nix nix-shell --attr env release.nix download_stats: diff --git a/default.nix b/default.nix deleted file mode 100644 index a18be1fa8..000000000 --- a/default.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ mkDerivation, aeson, aeson-pretty, attoparsec, base -, base64-bytestring, binary, blaze-html, blaze-markup, bytestring -, case-insensitive, citeproc, commonmark, commonmark-extensions -, commonmark-pandoc, connection, containers, criterion -, data-default, deepseq, Diff, directory, doclayout, doctemplates -, emojis, exceptions, executable-path, file-embed, filepath, Glob -, haddock-library, hslua, hslua-module-system, hslua-module-text -, HsYAML, HTTP, http-client, http-client-tls, http-types, ipynb -, jira-wiki-markup, JuicyPixels, mtl, network, network-uri -, pandoc-types, parsec, process, QuickCheck, random, safe -, scientific, SHA, skylighting, skylighting-core, split, stdenv -, syb, tagsoup, tasty, tasty-golden, tasty-hunit, tasty-lua -, tasty-quickcheck, temporary, texmath, text, text-conversions -, time, unicode-transforms, unix, unordered-containers, weigh, xml -, zip-archive, zlib -}: -mkDerivation { - pname = "pandoc"; - version = "2.11.4"; - src = ./.; - configureFlags = [ "-fhttps" "-f-trypandoc" ]; - isLibrary = true; - isExecutable = true; - enableSeparateDataOutput = true; - libraryHaskellDepends = [ - aeson aeson-pretty attoparsec base base64-bytestring binary - blaze-html blaze-markup bytestring case-insensitive citeproc - commonmark commonmark-extensions commonmark-pandoc connection - containers data-default deepseq directory doclayout doctemplates - emojis exceptions file-embed filepath Glob haddock-library hslua - hslua-module-system hslua-module-text HsYAML HTTP http-client - http-client-tls http-types ipynb jira-wiki-markup JuicyPixels mtl - network network-uri pandoc-types parsec process random safe - scientific SHA skylighting skylighting-core split syb tagsoup - temporary texmath text text-conversions time unicode-transforms - unix unordered-containers xml zip-archive zlib - ]; - executableHaskellDepends = [ base ]; - testHaskellDepends = [ - base base64-bytestring bytestring containers Diff directory - doctemplates exceptions executable-path filepath Glob hslua mtl - pandoc-types process QuickCheck tasty tasty-golden tasty-hunit - tasty-lua tasty-quickcheck temporary text time xml zip-archive - ]; - benchmarkHaskellDepends = [ - base bytestring containers criterion mtl text time weigh - ]; - postInstall = '' - mkdir -p $out/share/man/man1 - mv "man/"*.1 $out/share/man/man1/ - ''; - homepage = "https://pandoc.org"; - description = "Conversion between markup formats"; - license = stdenv.lib.licenses.gpl2Plus; -} -- cgit v1.2.3 From 2787083b7625e6a0e16f65edb06781da0c9afe84 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 12 Jan 2021 22:32:26 -0800 Subject: Use project.nix instead of default.nix for generated file. --- Makefile | 4 ++-- release.nix | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1f7fd98b4..495539701 100644 --- a/Makefile +++ b/Makefile @@ -91,10 +91,10 @@ README.md: README.template MANUAL.txt tools/update-readme.lua pandoc --lua-filter tools/update-readme.lua \ --reference-location=section -t gfm $< -o $@ -default.nix: pandoc.cabal +project.nix: pandoc.cabal nix-shell --pure -p cabal2nix --run "cabal2nix ." > $@ -nix-shell: default.nix +nix-shell: project.nix nix-shell --attr env release.nix download_stats: diff --git a/release.nix b/release.nix index e28be9ac3..857ea3286 100644 --- a/release.nix +++ b/release.nix @@ -1,4 +1,4 @@ let pkgs = import { }; in - pkgs.haskellPackages.callPackage ./default.nix { } + pkgs.haskellPackages.callPackage ./project.nix { } -- cgit v1.2.3 From 76b36fcb17d9686620032bbfe7eb7f60eadfb057 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 13 Jan 2021 09:51:45 -0800 Subject: Use simple default.nix. Remove nix makefile targets. --- Makefile | 8 +------- default.nix | 13 +++++++++++++ 2 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 default.nix (limited to 'Makefile') diff --git a/Makefile b/Makefile index 495539701..f27272b08 100644 --- a/Makefile +++ b/Makefile @@ -91,12 +91,6 @@ README.md: README.template MANUAL.txt tools/update-readme.lua pandoc --lua-filter tools/update-readme.lua \ --reference-location=section -t gfm $< -o $@ -project.nix: pandoc.cabal - nix-shell --pure -p cabal2nix --run "cabal2nix ." > $@ - -nix-shell: project.nix - nix-shell --attr env release.nix - download_stats: curl https://api.github.com/repos/jgm/pandoc/releases | \ jq -r '.[] | .assets | .[] | "\(.download_count)\t\(.name)"' @@ -130,4 +124,4 @@ sdist-files.txt: .FORCE git-files.txt: .FORCE git ls-tree -r --name-only HEAD | grep '^\(test\|data\)\/' | sort > $@ -.PHONY: .FORCE deps quick full haddock install clean test bench changes_github dist prof download_stats reformat lint weigh doc/lua-filters.md pandoc-templates trypandoc update-website debpkg checkdocs ghcid ghci fix_spacing hlint check check-cabal nix-shell +.PHONY: .FORCE deps quick full haddock install clean test bench changes_github dist prof download_stats reformat lint weigh doc/lua-filters.md pandoc-templates trypandoc update-website debpkg checkdocs ghcid ghci fix_spacing hlint check check-cabal diff --git a/default.nix b/default.nix new file mode 100644 index 000000000..0aa98f022 --- /dev/null +++ b/default.nix @@ -0,0 +1,13 @@ +# default.nix +let + pkgs = import { }; +in + pkgs.haskellPackages.developPackage { + root = ./.; + modifier = drv: + pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages; + [ cabal-install + ghcid + ]); + } + -- cgit v1.2.3 From fe06437ba4ef12782078ac05c6f9c917f32d51f0 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 30 Jan 2021 18:01:14 -0800 Subject: Use tasty-bench instead of criterion for benchmarks. It is much lighter-weight. --- Makefile | 1 + benchmark/benchmark-pandoc.hs | 25 ++++++++++++++----------- pandoc.cabal | 3 ++- stack.yaml | 1 + 4 files changed, 18 insertions(+), 12 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index f27272b08..1985a4810 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ RESOLVER?=lts-13 GHCOPTS=-fdiagnostics-color=always WEBSITE=../../web/pandoc.org REVISION?=1 +BENCHARGS?="--timeout=6" quick: stack install --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --fast --test --ghc-options='-j +RTS -A64m -RTS' --test-arguments='-j4 --hide-successes $(TESTARGS)' diff --git a/benchmark/benchmark-pandoc.hs b/benchmark/benchmark-pandoc.hs index b3e67bb14..2e7600cbc 100644 --- a/benchmark/benchmark-pandoc.hs +++ b/benchmark/benchmark-pandoc.hs @@ -24,8 +24,8 @@ import Control.Monad.Except (throwError, liftIO) import qualified Text.Pandoc.UTF8 as UTF8 import qualified Data.ByteString as B import qualified Data.Text as T -import Criterion.Main -import Criterion.Types (Config(..)) +import Test.Tasty.Bench +import Test.Tasty (withResource) import Data.List (intersect) import Data.Maybe (mapMaybe, catMaybes) import System.Environment (getArgs) @@ -59,7 +59,7 @@ readerBench doc name = do <> name return $ case res of Right (readerFun, inp) -> - Just $ bench (T.unpack $ name <> " reader") + Just $ bench (T.unpack name) $ nf (\i -> either (error . show) id $ runPure (readerFun i)) inp Left _ -> Nothing @@ -71,18 +71,18 @@ getImages = do return [("lalune.jpg", "image/jpg", ll) ,("movie.jpg", "image/jpg", mv)] -writerBench :: Pandoc +writerBench :: [(FilePath, MimeType, BL.ByteString)] + -> Pandoc -> T.Text -> Maybe Benchmark -writerBench doc name = +writerBench imgs doc name = case res of Right writerFun -> - Just $ env getImages $ \imgs -> - bench (T.unpack $ name <> " writer") + Just $ bench (T.unpack name) $ nf (\d -> either (error . show) id $ runPure (do mapM_ (\(fp, mt, bs) -> - insertMedia fp (Just mt) bs) + insertMedia fp (Just mt) bs) imgs writerFun d)) doc Left _ -> Nothing @@ -117,6 +117,9 @@ main = do (matchedReaders `intersect` allWriters) -- we need the corresponding writer to generate -- input for the reader - let writerBs = mapMaybe (writerBench doc) matchedWriters - defaultMainWith defaultConfig{ timeLimit = 6.0 } - (writerBs ++ readerBs) + imgs <- getImages + let writerBs = mapMaybe (writerBench imgs doc) matchedWriters + defaultMain + [ bgroup "writers" writerBs + , bgroup "readers" readerBs + ] diff --git a/pandoc.cabal b/pandoc.cabal index f7d48372b..6c8254616 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -880,7 +880,8 @@ benchmark benchmark-pandoc base >= 4.8 && < 5, bytestring, containers, - criterion >= 1.0 && < 1.6, + tasty, + tasty-bench >= 0.1 && <= 0.2, mtl >= 2.2 && < 2.3, text >= 1.1.1.0 && < 1.3, time diff --git a/stack.yaml b/stack.yaml index 5ef814487..85022e91d 100644 --- a/stack.yaml +++ b/stack.yaml @@ -18,6 +18,7 @@ extra-deps: - commonmark-pandoc-0.2.0.1 - doctemplates-0.9 - texmath-0.12.1 +- tasty-bench-0.1 # - citeproc-0.3.0.5 - citeproc: git: https://github.com/jgm/citeproc.git -- cgit v1.2.3 From 22faea15c249c1f84257d289ed6904f3abe64330 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 31 Jan 2021 18:18:53 -0800 Subject: Makefile: give allocation data in benchmarks. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1985a4810..a61e58270 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ RESOLVER?=lts-13 GHCOPTS=-fdiagnostics-color=always WEBSITE=../../web/pandoc.org REVISION?=1 -BENCHARGS?="--timeout=6" +BENCHARGS?="--timeout=6 +RTS -T -RTS" quick: stack install --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --fast --test --ghc-options='-j +RTS -A64m -RTS' --test-arguments='-j4 --hide-successes $(TESTARGS)' @@ -39,7 +39,7 @@ ghcid: ghcid -c "stack repl --flag 'pandoc:embed_data_files'" bench: - stack bench --benchmark-arguments='$(BENCHARGS)' --ghc-options '$(GHCOPTS)' + stack bench --benchmark-arguments=$(BENCHARGS) --ghc-options '$(GHCOPTS)' weigh: stack build --ghc-options '$(GHCOPTS)' pandoc:weigh-pandoc && stack exec weigh-pandoc -- cgit v1.2.3 From 1954e894b403a8b0f209e834a619c5893de1d22b Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 13 Feb 2021 00:14:49 -0800 Subject: Clean up benchmark code. Now we can do patterns using `-p blah'. --- Makefile | 5 +- benchmark/benchmark-pandoc.hs | 111 +++++++++++++++--------------------------- 2 files changed, 41 insertions(+), 75 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a61e58270..bcf09172a 100644 --- a/Makefile +++ b/Makefile @@ -2,11 +2,10 @@ version?=$(shell grep '^[Vv]ersion:' pandoc.cabal | awk '{print $$2;}') pandoc=$(shell find dist -name pandoc -type f -exec ls -t {} \; | head -1) SOURCEFILES?=$(shell git ls-tree -r master --name-only | grep "\.hs$$") BRANCH?=master -RESOLVER?=lts-13 GHCOPTS=-fdiagnostics-color=always WEBSITE=../../web/pandoc.org REVISION?=1 -BENCHARGS?="--timeout=6 +RTS -T -RTS" +BENCHARGS?=--timeout=6 +RTS -T -RTS $(if $(PATTERN),--pattern "$(PATTERN)",) quick: stack install --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --fast --test --ghc-options='-j +RTS -A64m -RTS' --test-arguments='-j4 --hide-successes $(TESTARGS)' @@ -39,7 +38,7 @@ ghcid: ghcid -c "stack repl --flag 'pandoc:embed_data_files'" bench: - stack bench --benchmark-arguments=$(BENCHARGS) --ghc-options '$(GHCOPTS)' + stack bench --benchmark-arguments='$(BENCHARGS)' --ghc-options '$(GHCOPTS)' weigh: stack build --ghc-options '$(GHCOPTS)' pandoc:weigh-pandoc && stack exec weigh-pandoc diff --git a/benchmark/benchmark-pandoc.hs b/benchmark/benchmark-pandoc.hs index 496732693..96810a477 100644 --- a/benchmark/benchmark-pandoc.hs +++ b/benchmark/benchmark-pandoc.hs @@ -18,48 +18,37 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -} import Text.Pandoc import Text.Pandoc.MIME -import Control.Monad.Except (throwError, liftIO) +import Control.Monad.Except (throwError) import qualified Text.Pandoc.UTF8 as UTF8 import qualified Data.ByteString as B import qualified Data.Text as T import Test.Tasty.Bench -import Data.List (intersect) -import Data.Maybe (mapMaybe, catMaybes) -import System.Environment (getArgs) import qualified Data.ByteString.Lazy as BL - -data Input = InputText {unInputText :: T.Text} - | InputBS {unInputBS :: BL.ByteString} +import Data.Maybe (mapMaybe) readerBench :: Pandoc -> T.Text - -> IO (Maybe Benchmark) -readerBench doc name = do - let (rdr, rexts) = either (error . show) id . runPure $ getReader name - res <- runIO $ do - (wtr, wexts) <- getWriter name - case (rdr, wtr) of - (TextReader r, TextWriter w) -> do - setResourcePath ["./test"] - inp <- w def{ writerWrapText = WrapAuto - , writerExtensions = wexts } doc - return (r def{ readerExtensions = rexts } . unInputText, InputText inp) - (ByteStringReader r, ByteStringWriter w) -> do - setResourcePath ["./test"] - tmpl <- Just <$> compileDefaultTemplate name - inp <- w def{ writerWrapText = WrapAuto - , writerExtensions = wexts - , writerTemplate = tmpl } doc - liftIO $ BL.writeFile "/tmp/test.odt" inp - return (r def{ readerExtensions = rexts } . unInputBS, InputBS inp) - _ -> throwError $ PandocSomeError $ "text/bytestring format mismatch: " - <> name - return $ case res of - Right (readerFun, inp) -> - Just $ bench (T.unpack name) - $ nf (\i -> either (error . show) id $ runPure (readerFun i)) - inp - Left _ -> Nothing + -> Maybe Benchmark +readerBench doc name = either (const Nothing) Just $ + runPure $ do + (rdr, rexts) <- getReader name + (wtr, wexts) <- getWriter name + case (rdr, wtr) of + (TextReader r, TextWriter w) -> do + inp <- w def{ writerWrapText = WrapAuto + , writerExtensions = wexts } doc + return $ bench (T.unpack name) $ + nf (either (error . show) id . runPure . r def) inp + (ByteStringReader r, ByteStringWriter w) -> do + tmpl <- Just <$> compileDefaultTemplate name + inp <- w def{ writerWrapText = WrapAuto + , writerExtensions = wexts + , writerTemplate = tmpl } doc + return $ bench (T.unpack name) $ + nf (either (error . show) id . + runPure . r def{readerExtensions = rexts}) inp + _ -> throwError $ PandocSomeError $ "text/bytestring format mismatch: " + <> name getImages :: IO [(FilePath, MimeType, BL.ByteString)] getImages = do @@ -72,51 +61,29 @@ writerBench :: [(FilePath, MimeType, BL.ByteString)] -> Pandoc -> T.Text -> Maybe Benchmark -writerBench imgs doc name = - case res of - Right writerFun -> - Just $ bench (T.unpack name) +writerBench imgs doc name = either (const Nothing) Just $ + runPure $ do + (wtr, wexts) <- getWriter name + case wtr of + TextWriter writerFun -> + return $ bench (T.unpack name) $ nf (\d -> either (error . show) id $ - runPure (do mapM_ - (\(fp, mt, bs) -> - insertMedia fp (Just mt) bs) - imgs - writerFun d)) doc - Left _ -> Nothing - where res = runPure $ do - (wtr, wexts) <- getWriter name - case wtr of - TextWriter w -> - return $ w def{ writerExtensions = wexts } - _ -> throwError $ PandocSomeError - $ "could not get text writer for " <> name + runPure $ do + mapM_ (\(fp,mt,bs) -> insertMedia fp (Just mt) bs) imgs + writerFun def{ writerExtensions = wexts} d) + doc + _ -> throwError $ PandocSomeError + $ "could not get text writer for " <> name main :: IO () main = do - args <- filter (\x -> T.take 1 x /= "-") . fmap T.pack <$> getArgs - print args - let matchReader (n, _) = - null args || ("reader" `elem` args && n `elem` args) - matchWriter (n, TextWriter _) = - null args || ("writer" `elem` args && n `elem` args) - matchWriter _ = False - allWriters = map fst (writers :: [(T.Text, Writer PandocPure)]) - matchedReaders = map fst (filter matchReader readers - :: [(T.Text, Reader PandocPure)]) - matchedWriters = map fst (filter matchWriter writers - :: [(T.Text, Writer PandocPure)]) inp <- UTF8.toText <$> B.readFile "test/testsuite.txt" let opts = def let doc = either (error . show) id $ runPure $ readMarkdown opts inp - readerBs <- fmap catMaybes - $ mapM (readerBench doc) - $ filter (/="haddock") - (matchedReaders `intersect` allWriters) - -- we need the corresponding writer to generate - -- input for the reader imgs <- getImages - let writerBs = mapMaybe (writerBench imgs doc) matchedWriters defaultMain - [ bgroup "writers" writerBs - , bgroup "readers" readerBs + [ bgroup "writers" $ mapMaybe (writerBench imgs doc . fst) + (writers :: [(T.Text, Writer PandocPure)]) + , bgroup "readers" $ mapMaybe (readerBench doc . fst) + (readers :: [(T.Text, Reader PandocPure)]) ] -- cgit v1.2.3 From b2b32d9bb2bb27b4f207db6d95938390b6ac8042 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 18 Feb 2021 23:22:18 -0800 Subject: 'make bench': Create csv files for comparison. --- Makefile | 3 ++- pandoc.cabal | 2 +- stack.yaml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index bcf09172a..4f72ac9d4 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ version?=$(shell grep '^[Vv]ersion:' pandoc.cabal | awk '{print $$2;}') pandoc=$(shell find dist -name pandoc -type f -exec ls -t {} \; | head -1) SOURCEFILES?=$(shell git ls-tree -r master --name-only | grep "\.hs$$") BRANCH?=master +COMMIT=$(shell git rev-parse --short HEAD) GHCOPTS=-fdiagnostics-color=always WEBSITE=../../web/pandoc.org REVISION?=1 @@ -38,7 +39,7 @@ ghcid: ghcid -c "stack repl --flag 'pandoc:embed_data_files'" bench: - stack bench --benchmark-arguments='$(BENCHARGS)' --ghc-options '$(GHCOPTS)' + stack bench --benchmark-arguments='$(BENCHARGS) --csv bench-$(COMMIT).csv' --ghc-options '$(GHCOPTS)' weigh: stack build --ghc-options '$(GHCOPTS)' pandoc:weigh-pandoc && stack exec weigh-pandoc diff --git a/pandoc.cabal b/pandoc.cabal index ae4e8b341..30226f445 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -827,6 +827,6 @@ benchmark benchmark-pandoc build-depends: bytestring, containers, tasty, - tasty-bench >= 0.1 && <= 0.2, + tasty-bench >= 0.2 && <= 0.3, mtl >= 2.2 && < 2.3, time diff --git a/stack.yaml b/stack.yaml index dcb1c9742..4af76f19e 100644 --- a/stack.yaml +++ b/stack.yaml @@ -11,7 +11,7 @@ extra-deps: - commonmark-0.1.1.4 - commonmark-extensions-0.2.0.4 - commonmark-pandoc-0.2.0.1 -- tasty-bench-0.1 +- tasty-bench-0.2.1 - citeproc-0.3.0.7 #- citeproc: # git: https://github.com/jgm/citeproc.git -- cgit v1.2.3 From b745bf393801aedb3ab336b9974c88377dc5dd23 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 19 Feb 2021 10:12:29 -0800 Subject: make bench: compare against a baseline, use datestamps for bench results. --- Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 4f72ac9d4..134aedcb4 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,13 @@ pandoc=$(shell find dist -name pandoc -type f -exec ls -t {} \; | head -1) SOURCEFILES?=$(shell git ls-tree -r master --name-only | grep "\.hs$$") BRANCH?=master COMMIT=$(shell git rev-parse --short HEAD) +TIMESTAMP=$(shell date "+%Y%m%d_%H%M") +LATESTBENCH=$(word 1,$(shell ls -t bench_*.csv)) +ifeq ($(LATESTBENCH),) +BASELINE= +else +BASELINE=--baseline $(LATESTBENCH) +endif GHCOPTS=-fdiagnostics-color=always WEBSITE=../../web/pandoc.org REVISION?=1 @@ -39,7 +46,7 @@ ghcid: ghcid -c "stack repl --flag 'pandoc:embed_data_files'" bench: - stack bench --benchmark-arguments='$(BENCHARGS) --csv bench-$(COMMIT).csv' --ghc-options '$(GHCOPTS)' + stack bench --benchmark-arguments='$(BENCHARGS) $(BASELINE) --csv bench_$(TIMESTAMP).csv' --ghc-options '$(GHCOPTS)' weigh: stack build --ghc-options '$(GHCOPTS)' pandoc:weigh-pandoc && stack exec weigh-pandoc -- cgit v1.2.3 From 5c4eb7246b068deac1a9eac397094098f68ab048 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 5 Mar 2021 19:11:12 -0800 Subject: Makefile: debpkg: use new multi-arch GHC 8.10.4 docker... ...created by Olivier Benz. This should allow us to build on arm architecture. --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 134aedcb4..b357463be 100644 --- a/Makefile +++ b/Makefile @@ -83,7 +83,8 @@ debpkg: man/pandoc.1 -v `pwd`/linux/artifacts:/artifacts \ -e REVISION=$(REVISION) \ -w /mnt \ - utdemir/ghc-musl:v12-libgmp-ghc8101 bash \ + registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.10.4 \ + bash \ /mnt/linux/make_artifacts.sh man/pandoc.1: MANUAL.txt man/pandoc.1.before man/pandoc.1.after -- cgit v1.2.3 From 98374443309b47b6393afcc46ef39e3800064e5e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 5 Mar 2021 21:11:35 -0800 Subject: Makefile: exit smoothly if no prior benchmark files found. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index b357463be..420053b74 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ SOURCEFILES?=$(shell git ls-tree -r master --name-only | grep "\.hs$$") BRANCH?=master COMMIT=$(shell git rev-parse --short HEAD) TIMESTAMP=$(shell date "+%Y%m%d_%H%M") -LATESTBENCH=$(word 1,$(shell ls -t bench_*.csv)) +LATESTBENCH=$(word 1,$(shell ls -t bench_*.csv || exit 0)) ifeq ($(LATESTBENCH),) BASELINE= else -- cgit v1.2.3 From 70f9709455a6531bd9366d0e67194280d2accef2 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 5 Mar 2021 23:32:03 -0800 Subject: Makefile: choose linux docker image depending on arch. --- Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 420053b74..3de517a4e 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,14 @@ version?=$(shell grep '^[Vv]ersion:' pandoc.cabal | awk '{print $$2;}') pandoc=$(shell find dist -name pandoc -type f -exec ls -t {} \; | head -1) SOURCEFILES?=$(shell git ls-tree -r master --name-only | grep "\.hs$$") BRANCH?=master +ARCH=$(shell uname -m) +ifeq ($(ARCH),amd64) +DOCKERIMAGE=registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.10.4@sha256:83cfc60cb1df984b14d6277946002de6bc7bec25c827f5f9de3b0c5d3aeaa571 +else ifeq($(ARCH),aarch64) +DOCKERIMAGE=registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.10.4@sha256:e54a66cf8ef7f8a60b93f6a51cae7a0bd853a763098ffb3dbda2bf91b7ab49ad +else +DOCKERIMAGE=UNSUPPORTEDARCHITECTURE +endif COMMIT=$(shell git rev-parse --short HEAD) TIMESTAMP=$(shell date "+%Y%m%d_%H%M") LATESTBENCH=$(word 1,$(shell ls -t bench_*.csv || exit 0)) @@ -83,7 +91,8 @@ debpkg: man/pandoc.1 -v `pwd`/linux/artifacts:/artifacts \ -e REVISION=$(REVISION) \ -w /mnt \ - registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.10.4 \ + --rm \ + $(DOCKERIMAGE) \ bash \ /mnt/linux/make_artifacts.sh -- cgit v1.2.3 From ce7706d75bc77cd837ca0dcf405707a8540fbda2 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 5 Mar 2021 23:59:50 -0800 Subject: More Makefile tweaks around docker linux build. --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 3de517a4e..abeefabf4 100644 --- a/Makefile +++ b/Makefile @@ -4,15 +4,15 @@ SOURCEFILES?=$(shell git ls-tree -r master --name-only | grep "\.hs$$") BRANCH?=master ARCH=$(shell uname -m) ifeq ($(ARCH),amd64) -DOCKERIMAGE=registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.10.4@sha256:83cfc60cb1df984b14d6277946002de6bc7bec25c827f5f9de3b0c5d3aeaa571 -else ifeq($(ARCH),aarch64) -DOCKERIMAGE=registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.10.4@sha256:e54a66cf8ef7f8a60b93f6a51cae7a0bd853a763098ffb3dbda2bf91b7ab49ad + DOCKERIMAGE=registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.10.4@sha256:83cfc60cb1df984b14d6277946002de6bc7bec25c827f5f9de3b0c5d3aeaa571 +else ifeq ($(ARCH),aarch64) + DOCKERIMAGE=registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.10.4@sha256:e54a66cf8ef7f8a60b93f6a51cae7a0bd853a763098ffb3dbda2bf91b7ab49ad else -DOCKERIMAGE=UNSUPPORTEDARCHITECTURE + DOCKERIMAGE=UNSUPPORTEDARCHITECTURE endif COMMIT=$(shell git rev-parse --short HEAD) TIMESTAMP=$(shell date "+%Y%m%d_%H%M") -LATESTBENCH=$(word 1,$(shell ls -t bench_*.csv || exit 0)) +LATESTBENCH=$(word 1,$(shell ls -t bench_*.csv 2>/dev/null)) ifeq ($(LATESTBENCH),) BASELINE= else @@ -91,6 +91,7 @@ debpkg: man/pandoc.1 -v `pwd`/linux/artifacts:/artifacts \ -e REVISION=$(REVISION) \ -w /mnt \ + --memory=0 \ --rm \ $(DOCKERIMAGE) \ bash \ -- cgit v1.2.3 From 26524246d0e3460338c9e90a171c554646abe4dc Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 6 Mar 2021 09:50:31 -0800 Subject: Fix docker image. --- Makefile | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index abeefabf4..5f74cfd2e 100644 --- a/Makefile +++ b/Makefile @@ -3,13 +3,7 @@ pandoc=$(shell find dist -name pandoc -type f -exec ls -t {} \; | head -1) SOURCEFILES?=$(shell git ls-tree -r master --name-only | grep "\.hs$$") BRANCH?=master ARCH=$(shell uname -m) -ifeq ($(ARCH),amd64) - DOCKERIMAGE=registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.10.4@sha256:83cfc60cb1df984b14d6277946002de6bc7bec25c827f5f9de3b0c5d3aeaa571 -else ifeq ($(ARCH),aarch64) - DOCKERIMAGE=registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.10.4@sha256:e54a66cf8ef7f8a60b93f6a51cae7a0bd853a763098ffb3dbda2bf91b7ab49ad -else - DOCKERIMAGE=UNSUPPORTEDARCHITECTURE -endif +DOCKERIMAGE=registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.10.4 COMMIT=$(shell git rev-parse --short HEAD) TIMESTAMP=$(shell date "+%Y%m%d_%H%M") LATESTBENCH=$(word 1,$(shell ls -t bench_*.csv 2>/dev/null)) -- cgit v1.2.3 From faa77316ca92cdb8dca981bd71726b692682de1d Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 6 Mar 2021 12:31:04 -0800 Subject: Don't --rm docker. --- Makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 5f74cfd2e..e5da75616 100644 --- a/Makefile +++ b/Makefile @@ -86,7 +86,6 @@ debpkg: man/pandoc.1 -e REVISION=$(REVISION) \ -w /mnt \ --memory=0 \ - --rm \ $(DOCKERIMAGE) \ bash \ /mnt/linux/make_artifacts.sh -- cgit v1.2.3 From f31ddecdac4c1f04a650324b0fb2b1c38ea5695e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 6 Mar 2021 13:44:36 -0800 Subject: Makefile: Remove ARCH --- Makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e5da75616..bbf8fdbd8 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,6 @@ version?=$(shell grep '^[Vv]ersion:' pandoc.cabal | awk '{print $$2;}') pandoc=$(shell find dist -name pandoc -type f -exec ls -t {} \; | head -1) SOURCEFILES?=$(shell git ls-tree -r master --name-only | grep "\.hs$$") BRANCH?=master -ARCH=$(shell uname -m) DOCKERIMAGE=registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.10.4 COMMIT=$(shell git rev-parse --short HEAD) TIMESTAMP=$(shell date "+%Y%m%d_%H%M") -- cgit v1.2.3 From 271dd9e34445d09cdf12bb91de48bb0bfa7a1125 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 6 Mar 2021 16:34:45 -0800 Subject: make debpkg: send docker output to docker.log in the host. Otherwise once the container is gone we can't figure out what happened. --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index bbf8fdbd8..aca6f2ee7 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ version?=$(shell grep '^[Vv]ersion:' pandoc.cabal | awk '{print $$2;}') pandoc=$(shell find dist -name pandoc -type f -exec ls -t {} \; | head -1) SOURCEFILES?=$(shell git ls-tree -r master --name-only | grep "\.hs$$") BRANCH?=master +ARCH=$(shell uname -m) DOCKERIMAGE=registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.10.4 COMMIT=$(shell git rev-parse --short HEAD) TIMESTAMP=$(shell date "+%Y%m%d_%H%M") @@ -80,14 +81,15 @@ checkdocs: ! grep -q -n -e "\t" MANUAL.txt changelog.md debpkg: man/pandoc.1 - docker run -v `pwd`:/mnt \ + (docker run -v `pwd`:/mnt \ -v `pwd`/linux/artifacts:/artifacts \ -e REVISION=$(REVISION) \ -w /mnt \ --memory=0 \ + --rm \ $(DOCKERIMAGE) \ bash \ - /mnt/linux/make_artifacts.sh + /mnt/linux/make_artifacts.sh) 2>&1 > docker.log man/pandoc.1: MANUAL.txt man/pandoc.1.before man/pandoc.1.after pandoc $< -f markdown -t man -s \ -- cgit v1.2.3 From cf175c97523f09b13db984801ba15e35978d1137 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 6 Mar 2021 16:59:35 -0800 Subject: Avoid subprocess for docker run. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index aca6f2ee7..2c112d66d 100644 --- a/Makefile +++ b/Makefile @@ -81,7 +81,7 @@ checkdocs: ! grep -q -n -e "\t" MANUAL.txt changelog.md debpkg: man/pandoc.1 - (docker run -v `pwd`:/mnt \ + docker run -v `pwd`:/mnt \ -v `pwd`/linux/artifacts:/artifacts \ -e REVISION=$(REVISION) \ -w /mnt \ @@ -89,7 +89,7 @@ debpkg: man/pandoc.1 --rm \ $(DOCKERIMAGE) \ bash \ - /mnt/linux/make_artifacts.sh) 2>&1 > docker.log + /mnt/linux/make_artifacts.sh 2>&1 > docker.log man/pandoc.1: MANUAL.txt man/pandoc.1.before man/pandoc.1.after pandoc $< -f markdown -t man -s \ -- cgit v1.2.3 From 09f81c16c5fec6c140e0fc9e4b8eb10796d0fd37 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 6 Mar 2021 17:03:36 -0800 Subject: Set --user in docker run to avoid permission issues. We were unable previously to write to the artifacts directory. --- Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 2c112d66d..af5b755cc 100644 --- a/Makefile +++ b/Makefile @@ -83,6 +83,7 @@ checkdocs: debpkg: man/pandoc.1 docker run -v `pwd`:/mnt \ -v `pwd`/linux/artifacts:/artifacts \ + --user $(id -u):$(id -g) \ -e REVISION=$(REVISION) \ -w /mnt \ --memory=0 \ -- cgit v1.2.3 From 9bd36b03e97840b2d8ebd8b69d44f898c11d0812 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 12 Mar 2021 19:12:20 -0800 Subject: Add ghcid-test to Makefile --- Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index af5b755cc..e37094d4c 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,9 @@ test: ghcid: ghcid -c "stack repl --flag 'pandoc:embed_data_files'" +ghcid-test: + ghcid -c "stack repl --ghc-options=-XNoImplicitPrelude --flag 'pandoc:embed_data_files' --ghci-options=-fobject-code pandoc:lib pandoc:test-pandoc" + bench: stack bench --benchmark-arguments='$(BENCHARGS) $(BASELINE) --csv bench_$(TIMESTAMP).csv' --ghc-options '$(GHCOPTS)' -- cgit v1.2.3 From 78775751d900c4b1a010c85a4026b11bf3ee4f68 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 15 Mar 2021 18:47:10 -0700 Subject: Add compiler timings to 'make bench' --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e37094d4c..24df6da46 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ ghcid-test: ghcid -c "stack repl --ghc-options=-XNoImplicitPrelude --flag 'pandoc:embed_data_files' --ghci-options=-fobject-code pandoc:lib pandoc:test-pandoc" bench: - stack bench --benchmark-arguments='$(BENCHARGS) $(BASELINE) --csv bench_$(TIMESTAMP).csv' --ghc-options '$(GHCOPTS)' + stack bench --benchmark-arguments='$(BENCHARGS) $(BASELINE) --csv bench_$(TIMESTAMP).csv' --ghc-options '-Rghc-timing $(GHCOPTS)' weigh: stack build --ghc-options '$(GHCOPTS)' pandoc:weigh-pandoc && stack exec weigh-pandoc -- cgit v1.2.3 From ff0fcedcb3c33015f9d550acce8fad2d662d49bd Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 15 Mar 2021 22:50:18 -0700 Subject: Switch to gauge for now for benchmarks. tasty-bench is displaying odd behavior, with different timings depending on the `--pattern` specified. --- Makefile | 13 ++++++++++--- benchmark/benchmark-pandoc.hs | 14 +++++++------- pandoc.cabal | 6 +++--- 3 files changed, 20 insertions(+), 13 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 24df6da46..04b57939d 100644 --- a/Makefile +++ b/Makefile @@ -51,10 +51,17 @@ ghcid-test: ghcid -c "stack repl --ghc-options=-XNoImplicitPrelude --flag 'pandoc:embed_data_files' --ghci-options=-fobject-code pandoc:lib pandoc:test-pandoc" bench: - stack bench --benchmark-arguments='$(BENCHARGS) $(BASELINE) --csv bench_$(TIMESTAMP).csv' --ghc-options '-Rghc-timing $(GHCOPTS)' + stack bench \ + --ghc-options '-Rghc-timing $(GHCOPTS)' \ + --benchmark-arguments='--small --time-limit=2 \ + --match=pattern $(PATTERN)' 2>&1 | \ + tee "bench_latest.txt" + perl -pe 's/\x1b\[[0-9;]*[mGK]//g;s/\r//;' bench_latest.txt > \ + "bench_$(TIMESTAMP).txt" -weigh: - stack build --ghc-options '$(GHCOPTS)' pandoc:weigh-pandoc && stack exec weigh-pandoc + +# With tasty-bench, we used +# --benchmark-arguments='$(BENCHARGS) $(BASELINE) --csv bench_$(TIMESTAMP).csv' --ghc-options '-Rghc-timing $(GHCOPTS)' reformat: for f in $(SOURCEFILES); do echo $$f; stylish-haskell -i $$f ; done diff --git a/benchmark/benchmark-pandoc.hs b/benchmark/benchmark-pandoc.hs index a4e72f584..f9a872011 100644 --- a/benchmark/benchmark-pandoc.hs +++ b/benchmark/benchmark-pandoc.hs @@ -18,12 +18,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -} import Text.Pandoc import Text.Pandoc.MIME -import Control.Monad (when) +import Control.DeepSeq (force) import Control.Monad.Except (throwError) import qualified Text.Pandoc.UTF8 as UTF8 import qualified Data.ByteString as B import qualified Data.Text as T -import Test.Tasty.Bench +import Gauge import qualified Data.ByteString.Lazy as BL import Data.Maybe (mapMaybe) import Data.List (sortOn) @@ -31,10 +31,10 @@ import Data.List (sortOn) readerBench :: Pandoc -> T.Text -> Maybe Benchmark +readerBench _ name + | name `elem` ["bibtex", "biblatex", "csljson"] = Nothing readerBench doc name = either (const Nothing) Just $ runPure $ do - when (name `elem` ["bibtex", "biblatex", "csljson"]) $ - throwError $ PandocSomeError $ name <> " not supported for benchmark" (rdr, rexts) <- getReader name (wtr, wexts) <- getWriter name case (rdr, wtr) of @@ -65,10 +65,10 @@ writerBench :: [(FilePath, MimeType, BL.ByteString)] -> Pandoc -> T.Text -> Maybe Benchmark +writerBench _ _ name + | name `elem` ["bibtex", "biblatex", "csljson"] = Nothing writerBench imgs doc name = either (const Nothing) Just $ runPure $ do - when (name `elem` ["bibtex", "biblatex", "csljson"]) $ - throwError $ PandocSomeError $ name <> " not supported for benchmark" (wtr, wexts) <- getWriter name case wtr of TextWriter writerFun -> @@ -90,7 +90,7 @@ main :: IO () main = do inp <- UTF8.toText <$> B.readFile "test/testsuite.txt" let opts = def - let doc = either (error . show) id $ runPure $ readMarkdown opts inp + let doc = either (error . show) force $ runPure $ readMarkdown opts inp defaultMain [ env getImages $ \imgs -> bgroup "writers" $ mapMaybe (writerBench imgs doc . fst) diff --git a/pandoc.cabal b/pandoc.cabal index ad3b64909..647505211 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -826,8 +826,8 @@ benchmark benchmark-pandoc hs-source-dirs: benchmark build-depends: bytestring, containers, - tasty, - tasty-bench >= 0.2 && <= 0.3, + gauge >= 0.2 && < 0.3, mtl >= 2.2 && < 2.3, text >= 1.1.1.0 && < 1.3, - time + time, + deepseq -- cgit v1.2.3 From d0af5795f1de5a75028d48b2d48105d435cbbac3 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 16 Mar 2021 10:02:25 -0700 Subject: make quick: use -j4 to speed up build --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 04b57939d..93811d3a6 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ REVISION?=1 BENCHARGS?=--timeout=6 +RTS -T -RTS $(if $(PATTERN),--pattern "$(PATTERN)",) quick: - stack install --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --fast --test --ghc-options='-j +RTS -A64m -RTS' --test-arguments='-j4 --hide-successes $(TESTARGS)' + stack install --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --fast --test --ghc-options='-j4 +RTS -A256m -RTS' --test-arguments='-j4 --hide-successes $(TESTARGS)' quick-cabal: cabal new-configure . --ghc-options '$(GHCOPTS)' --disable-optimization --enable-tests -- cgit v1.2.3 From b6b40de7fc5c0906bc8d95addaac621fd8a8fb34 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 16 Mar 2021 13:07:37 -0700 Subject: Use BENCHARGS in 'make bench'. --- Makefile | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 93811d3a6..274c6f9f2 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,9 @@ endif GHCOPTS=-fdiagnostics-color=always WEBSITE=../../web/pandoc.org REVISION?=1 -BENCHARGS?=--timeout=6 +RTS -T -RTS $(if $(PATTERN),--pattern "$(PATTERN)",) +BENCHARGS?=--small --time-limit=2 --match=pattern $(PATTERN) +# For tasty-bench: +# BENCHARGS?=--csv bench_$(TIMESTAMP).csv --timeout=6 +RTS -T -RTS $(if $(PATTERN),--pattern "$(PATTERN)",) quick: stack install --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --fast --test --ghc-options='-j4 +RTS -A256m -RTS' --test-arguments='-j4 --hide-successes $(TESTARGS)' @@ -53,16 +55,11 @@ ghcid-test: bench: stack bench \ --ghc-options '-Rghc-timing $(GHCOPTS)' \ - --benchmark-arguments='--small --time-limit=2 \ - --match=pattern $(PATTERN)' 2>&1 | \ + --benchmark-arguments='$(BENCHARGS)' 2>&1 | \ tee "bench_latest.txt" perl -pe 's/\x1b\[[0-9;]*[mGK]//g;s/\r//;' bench_latest.txt > \ "bench_$(TIMESTAMP).txt" - -# With tasty-bench, we used -# --benchmark-arguments='$(BENCHARGS) $(BASELINE) --csv bench_$(TIMESTAMP).csv' --ghc-options '-Rghc-timing $(GHCOPTS)' - reformat: for f in $(SOURCEFILES); do echo $$f; stylish-haskell -i $$f ; done -- cgit v1.2.3 From 769891833054d9722325a9df1cf9fe6dc792c0c9 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 16 Mar 2021 13:08:01 -0700 Subject: make quick: re-use GHCOPTS for tests --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 274c6f9f2..196ab4740 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ BENCHARGS?=--small --time-limit=2 --match=pattern $(PATTERN) # BENCHARGS?=--csv bench_$(TIMESTAMP).csv --timeout=6 +RTS -T -RTS $(if $(PATTERN),--pattern "$(PATTERN)",) quick: - stack install --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --fast --test --ghc-options='-j4 +RTS -A256m -RTS' --test-arguments='-j4 --hide-successes $(TESTARGS)' + stack install --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --fast --test --ghc-options='$(GHCOPTS)' --test-arguments='-j4 --hide-successes $(TESTARGS)' quick-cabal: cabal new-configure . --ghc-options '$(GHCOPTS)' --disable-optimization --enable-tests -- cgit v1.2.3 From fdaa56cbcd4f4cb905511f2a131018f2e123dd8a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 16 Mar 2021 13:08:32 -0700 Subject: Makefile: set -j4 in default GHCOPTS --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 196ab4740..ac1850c2d 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ BASELINE= else BASELINE=--baseline $(LATESTBENCH) endif -GHCOPTS=-fdiagnostics-color=always +GHCOPTS=-fdiagnostics-color=always -j4 +RTS -A256m -RTS WEBSITE=../../web/pandoc.org REVISION?=1 BENCHARGS?=--small --time-limit=2 --match=pattern $(PATTERN) -- cgit v1.2.3 From 1ef35343288ae7cb1d074c6a25aa5e47fdc55da9 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 16 Mar 2021 15:59:50 -0700 Subject: Increase heap space in runtime for benchmarks. Otherwise we're essentially benchmarking garbage collecting, which can give very inconsistent results. --- Makefile | 9 +++++---- benchmark/benchmark-pandoc.hs | 1 + pandoc.cabal | 1 + stack.yaml | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index ac1850c2d..60aaeb43f 100644 --- a/Makefile +++ b/Makefile @@ -15,9 +15,10 @@ endif GHCOPTS=-fdiagnostics-color=always -j4 +RTS -A256m -RTS WEBSITE=../../web/pandoc.org REVISION?=1 -BENCHARGS?=--small --time-limit=2 --match=pattern $(PATTERN) +# For gauge: +BENCHARGS?=--small --ci=0.90 --match=pattern $(PATTERN) +RTS -T -A256m -I0 -RTS # For tasty-bench: -# BENCHARGS?=--csv bench_$(TIMESTAMP).csv --timeout=6 +RTS -T -RTS $(if $(PATTERN),--pattern "$(PATTERN)",) +# BENCHARGS?=--csv bench_$(TIMESTAMP).csv --timeout=6 +RTS -T -A256m -I0 -RTS $(if $(PATTERN),--pattern "$(PATTERN)",) quick: stack install --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --fast --test --ghc-options='$(GHCOPTS)' --test-arguments='-j4 --hide-successes $(TESTARGS)' @@ -57,8 +58,8 @@ bench: --ghc-options '-Rghc-timing $(GHCOPTS)' \ --benchmark-arguments='$(BENCHARGS)' 2>&1 | \ tee "bench_latest.txt" - perl -pe 's/\x1b\[[0-9;]*[mGK]//g;s/\r//;' bench_latest.txt > \ - "bench_$(TIMESTAMP).txt" + perl -ne 'if (/\r/) { s/\x1b\[[0-9;]*[mGK]//g;s/^.*\r//;print; }' \ + bench_latest.txt > "bench_$(TIMESTAMP).txt" reformat: for f in $(SOURCEFILES); do echo $$f; stylish-haskell -i $$f ; done diff --git a/benchmark/benchmark-pandoc.hs b/benchmark/benchmark-pandoc.hs index f9a872011..111e63274 100644 --- a/benchmark/benchmark-pandoc.hs +++ b/benchmark/benchmark-pandoc.hs @@ -23,6 +23,7 @@ import Control.Monad.Except (throwError) import qualified Text.Pandoc.UTF8 as UTF8 import qualified Data.ByteString as B import qualified Data.Text as T +-- import Test.Tasty.Bench import Gauge import qualified Data.ByteString.Lazy as BL import Data.Maybe (mapMaybe) diff --git a/pandoc.cabal b/pandoc.cabal index 647505211..2f49f0ac3 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -827,6 +827,7 @@ benchmark benchmark-pandoc build-depends: bytestring, containers, gauge >= 0.2 && < 0.3, + -- tasty-bench >= 0.2 && <= 0.3, mtl >= 2.2 && < 2.3, text >= 1.1.1.0 && < 1.3, time, diff --git a/stack.yaml b/stack.yaml index 0f21bbb6c..7a6462d51 100644 --- a/stack.yaml +++ b/stack.yaml @@ -13,6 +13,7 @@ extra-deps: - doclayout-0.3.0.2 - citeproc-0.3.0.9 - texmath-0.12.2 +- tasty-bench-0.2.2 ghc-options: "$locals": -fhide-source-paths -Wno-missing-home-modules resolver: lts-17.5 -- cgit v1.2.3 From 6075b17ae11e5f1670d5d6e715431c4242dfd943 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 16 Mar 2021 18:04:39 -0700 Subject: Makefile: add --static to quick target --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 60aaeb43f..a3547e7f2 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ BENCHARGS?=--small --ci=0.90 --match=pattern $(PATTERN) +RTS -T -A256m -I0 -RTS # BENCHARGS?=--csv bench_$(TIMESTAMP).csv --timeout=6 +RTS -T -A256m -I0 -RTS $(if $(PATTERN),--pattern "$(PATTERN)",) quick: - stack install --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --fast --test --ghc-options='$(GHCOPTS)' --test-arguments='-j4 --hide-successes $(TESTARGS)' + stack install --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --static --fast --test --ghc-options='$(GHCOPTS)' --test-arguments='-j4 --hide-successes $(TESTARGS)' quick-cabal: cabal new-configure . --ghc-options '$(GHCOPTS)' --disable-optimization --enable-tests -- cgit v1.2.3 From f54e218bf86c7de832d5002af5727d7923de272c Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 17 Mar 2021 08:57:25 -0700 Subject: Revert "Makefile: add --static to quick target" This reverts commit 6075b17ae11e5f1670d5d6e715431c4242dfd943. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a3547e7f2..60aaeb43f 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ BENCHARGS?=--small --ci=0.90 --match=pattern $(PATTERN) +RTS -T -A256m -I0 -RTS # BENCHARGS?=--csv bench_$(TIMESTAMP).csv --timeout=6 +RTS -T -A256m -I0 -RTS $(if $(PATTERN),--pattern "$(PATTERN)",) quick: - stack install --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --static --fast --test --ghc-options='$(GHCOPTS)' --test-arguments='-j4 --hide-successes $(TESTARGS)' + stack install --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --fast --test --ghc-options='$(GHCOPTS)' --test-arguments='-j4 --hide-successes $(TESTARGS)' quick-cabal: cabal new-configure . --ghc-options '$(GHCOPTS)' --disable-optimization --enable-tests -- cgit v1.2.3 From 84836719aabe055b12d8444f8a6e70c13336f614 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 17 Mar 2021 09:25:39 -0700 Subject: Makefile: Add comment documenting benchmark settings. --- Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 60aaeb43f..0ef0406f8 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,9 @@ endif GHCOPTS=-fdiagnostics-color=always -j4 +RTS -A256m -RTS WEBSITE=../../web/pandoc.org REVISION?=1 +# Note: for benchmarks we use +RTS -A256m -I0 -RTS ; otherwise the benchmarks +# are measuring garbage collecting, and this can vary depending on which +# other benchmarks are run. # For gauge: BENCHARGS?=--small --ci=0.90 --match=pattern $(PATTERN) +RTS -T -A256m -I0 -RTS # For tasty-bench: -- cgit v1.2.3 From c6e5cf2e7472ab872a537327a03ef9eb9fcef2a1 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 17 Mar 2021 13:34:17 -0700 Subject: Benchmark improvements. * Build `+RTS -A256m -RTS` into default ghc-options for benchmark, so we don't have to specify this separately on the command line. This is necessary to get accurate benchmark results; otherwise we are largely measuring garbage collecting, some not related to the current benchmark. * Switch back from gauge to tasty-bench. * Allow specifying BASELINE file in 'make bench' for comparison (otherwise the latest is chosen by default). * Remove obsolete reference to weigh-pandoc from CONTRIBUTING.md. * Remove `-Rghc-timing` from 'make bench'. --- CONTRIBUTING.md | 3 --- Makefile | 18 +++++++----------- benchmark/benchmark-pandoc.hs | 4 ++-- pandoc.cabal | 6 ++++-- 4 files changed, 13 insertions(+), 18 deletions(-) (limited to 'Makefile') diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 090cc0a4f..cf8d3aa03 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -318,9 +318,6 @@ With stack: stack bench -You can also build `weigh-pandoc` (`stack build pandoc:weigh-pandoc`) -to get some statistics on memory usage. (Eventually this should -be incorporated into the benchmark suite.) Using the REPL -------------- diff --git a/Makefile b/Makefile index 0ef0406f8..5e5bc7c51 100644 --- a/Makefile +++ b/Makefile @@ -7,21 +7,19 @@ DOCKERIMAGE=registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.10.4 COMMIT=$(shell git rev-parse --short HEAD) TIMESTAMP=$(shell date "+%Y%m%d_%H%M") LATESTBENCH=$(word 1,$(shell ls -t bench_*.csv 2>/dev/null)) -ifeq ($(LATESTBENCH),) -BASELINE= +BASELINE?=$(LATESTBENCH) +ifeq ($(BASELINE),) +BASELINECMD= else -BASELINE=--baseline $(LATESTBENCH) +BASELINECMD=--baseline $(BASELINE) endif GHCOPTS=-fdiagnostics-color=always -j4 +RTS -A256m -RTS WEBSITE=../../web/pandoc.org REVISION?=1 -# Note: for benchmarks we use +RTS -A256m -I0 -RTS ; otherwise the benchmarks -# are measuring garbage collecting, and this can vary depending on which -# other benchmarks are run. # For gauge: -BENCHARGS?=--small --ci=0.90 --match=pattern $(PATTERN) +RTS -T -A256m -I0 -RTS +# BENCHARGS?=--small --ci=0.90 --match=pattern $(PATTERN) # For tasty-bench: -# BENCHARGS?=--csv bench_$(TIMESTAMP).csv --timeout=6 +RTS -T -A256m -I0 -RTS $(if $(PATTERN),--pattern "$(PATTERN)",) +BENCHARGS?=--csv bench_$(TIMESTAMP).csv $(BASELINECMD) --timeout=6 +RTS -T -RTS $(if $(PATTERN),--pattern "$(PATTERN)",) quick: stack install --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --fast --test --ghc-options='$(GHCOPTS)' --test-arguments='-j4 --hide-successes $(TESTARGS)' @@ -58,11 +56,9 @@ ghcid-test: bench: stack bench \ - --ghc-options '-Rghc-timing $(GHCOPTS)' \ + --ghc-options '$(GHCOPTS)' \ --benchmark-arguments='$(BENCHARGS)' 2>&1 | \ tee "bench_latest.txt" - perl -ne 'if (/\r/) { s/\x1b\[[0-9;]*[mGK]//g;s/^.*\r//;print; }' \ - bench_latest.txt > "bench_$(TIMESTAMP).txt" reformat: for f in $(SOURCEFILES); do echo $$f; stylish-haskell -i $$f ; done diff --git a/benchmark/benchmark-pandoc.hs b/benchmark/benchmark-pandoc.hs index 111e63274..1890a998f 100644 --- a/benchmark/benchmark-pandoc.hs +++ b/benchmark/benchmark-pandoc.hs @@ -23,8 +23,8 @@ import Control.Monad.Except (throwError) import qualified Text.Pandoc.UTF8 as UTF8 import qualified Data.ByteString as B import qualified Data.Text as T --- import Test.Tasty.Bench -import Gauge +import Test.Tasty.Bench +-- import Gauge import qualified Data.ByteString.Lazy as BL import Data.Maybe (mapMaybe) import Data.List (sortOn) diff --git a/pandoc.cabal b/pandoc.cabal index 2f49f0ac3..3a7436370 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -826,9 +826,11 @@ benchmark benchmark-pandoc hs-source-dirs: benchmark build-depends: bytestring, containers, - gauge >= 0.2 && < 0.3, - -- tasty-bench >= 0.2 && <= 0.3, + -- gauge >= 0.2 && < 0.3, + tasty-bench >= 0.2 && <= 0.3, mtl >= 2.2 && < 2.3, text >= 1.1.1.0 && < 1.3, time, deepseq + -- we increase heap size to avoid benchmarking garbage collection: + ghc-options: -rtsopts -with-rtsopts=-A256m -threaded -- cgit v1.2.3 From 89a89a8cf33e1558e8a477f98a2c73bc224ccf60 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 18 Mar 2021 09:14:12 -0700 Subject: make_artifacts.sh: try using -j for cabal rather than -j4 ghc-options. --- Makefile | 4 ++-- linux/make_artifacts.sh | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 5e5bc7c51..ced5baf9f 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ quick: quick-cabal: cabal new-configure . --ghc-options '$(GHCOPTS)' --disable-optimization --enable-tests - cabal new-build . --disable-optimization + cabal new-build -j4 . --disable-optimization cabal new-run test-pandoc --disable-optimization -- --hide-successes $(TESTARGS) full-cabal: @@ -35,7 +35,7 @@ full-cabal: cabal new-run test-pandoc --disable-optimization -- --hide-successes $(TESTARGS) full: - stack install --flag 'pandoc:embed_data_files' --flag 'pandoc:trypandoc' --bench --no-run-benchmarks --test --test-arguments='-j4 --hide-successes' --ghc-options '-Wall -Werror -fno-warn-unused-do-bind -O0 -j4 $(GHCOPTS)' + stack install --flag 'pandoc:embed_data_files' --flag 'pandoc:trypandoc' --bench --no-run-benchmarks --test --test-arguments='-j4 --hide-successes' --ghc-options '-Wall -Werror -fno-warn-unused-do-bind -O0 $(GHCOPTS)' ghci: stack ghci --flag 'pandoc:embed_data_files' diff --git a/linux/make_artifacts.sh b/linux/make_artifacts.sh index cb7bf4c8c..b5625be1f 100644 --- a/linux/make_artifacts.sh +++ b/linux/make_artifacts.sh @@ -26,9 +26,9 @@ ghc --version cabal v2-update cabal v2-clean -cabal v2-configure --enable-tests -f-export-dynamic -fembed_data_files --enable-executable-static --ghc-options '-j4 +RTS -A256m -RTS -split-sections -optc-Os -optl=-pthread' pandoc -cabal v2-build -cabal v2-test -j4 +cabal v2-configure --enable-tests -f-export-dynamic -fembed_data_files --enable-executable-static --ghc-options '+RTS -A256m -RTS -split-sections -optc-Os -optl=-pthread' pandoc +cabal v2-build -j +cabal v2-test -j for f in $(find dist-newstyle -name 'pandoc' -type f -perm /400); do cp $f /artifacts/; done # make deb -- cgit v1.2.3 From 4c51fa1d55c31784311159447454b64e77283242 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 18 Mar 2021 13:07:54 -0700 Subject: Change -A256m to -A8m in GHCOPTS --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index ced5baf9f..6ae6ab491 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ BASELINECMD= else BASELINECMD=--baseline $(BASELINE) endif -GHCOPTS=-fdiagnostics-color=always -j4 +RTS -A256m -RTS +GHCOPTS=-fdiagnostics-color=always -j4 +RTS -A8m -RTS WEBSITE=../../web/pandoc.org REVISION?=1 # For gauge: -- cgit v1.2.3