From fcbdfe4ae4da14e9af0e21fabfe2da178f041970 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Fri, 8 Dec 2023 18:47:52 -0500 Subject: [PATCH] Add html-parse-length --- app/Main.hs | 15 +++++++++++++++ html-parse.cabal | 9 +++++++++ 2 files changed, 24 insertions(+) create mode 100644 app/Main.hs diff --git a/app/Main.hs b/app/Main.hs new file mode 100644 index 0000000..f66417b --- /dev/null +++ b/app/Main.hs @@ -0,0 +1,15 @@ +module Main where + +import Control.Monad +import qualified Data.Text as T +import qualified Data.Text.IO as T +import Text.HTML.Parser +import System.Environment + +main :: IO () +main = do + files <- getArgs + forM_ files $ \fname -> do + t <- T.readFile fname + print $ length $ parseTokens t + diff --git a/html-parse.cabal b/html-parse.cabal index 5a1c892..aa9fd01 100644 --- a/html-parse.cabal +++ b/html-parse.cabal @@ -103,3 +103,12 @@ test-suite spec string-conversions, text default-language: Haskell2010 + +-- For performance characterisation during optimisation +executable html-parse-length + main-is: app/Main.hs + --buildable: False + build-depends: base, + html-parse, + text + default-language: Haskell2010