diff --git a/brick.cabal b/brick.cabal index 216c89b..8390083 100644 --- a/brick.cabal +++ b/brick.cabal @@ -75,33 +75,6 @@ executable brick lens, text -Flag bench - Description: whether to build benchmarks - Default: False - -executable brick-bench - hs-source-dirs: programs,src - - if !flag(bench) - buildable: False - - ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3 - default-language: Haskell2010 - main-is: Bench.hs - CPP-Options: -DBENCH - build-depends: base <= 5, - transformers, - vty >= 5.2.9, - data-default, - lens, - text, - criterion, - deepseq, - contravariant, - template-haskell, - containers, - vector - executable brick-viewport-scroll-demo hs-source-dirs: programs ghc-options: -threaded -Wall -fno-warn-unused-do-bind -O3 diff --git a/programs/Bench.hs b/programs/Bench.hs deleted file mode 100644 index 093b13c..0000000 --- a/programs/Bench.hs +++ /dev/null @@ -1,72 +0,0 @@ -{-# OPTIONS_GHC -fno-warn-orphans #-} -module Main where - -import Criterion.Main -import Control.DeepSeq (NFData(..)) -import Data.Monoid -import Data.Default -import Graphics.Vty -import qualified Data.Text as T - -import Brick.AttrMap -import Brick.Widgets.Core -import Brick.Widgets.Border -import Brick.Widgets.Center - -instance NFData Widget where - rnf w = (hSize w) `seq` (vSize w) `seq` (render w) `seq` () - -aMap :: AttrMap -aMap = attrMap def [] - -sz :: DisplayRegion -sz = (100, 100) - -renderBench :: Widget -> Picture -renderBench w = pic - where - (_, pic, _) = renderFinal aMap [w] sz (const Nothing) (RS mempty mempty) - -mkBench :: String -> Widget -> Benchmark -mkBench s w = bench s (nf renderBench w) - -allGroups :: [Benchmark] -allGroups = - [ bgroup "widgets" - [ mkBench "str" (str "testing") - , mkBench "txt" (txt $ T.pack "testing") - , mkBench "hBorder" hBorder - , mkBench "hBorderWithLabel" (hBorderWithLabel (str "label")) - , mkBench "vBorder" vBorder - , mkBench "border" (border $ str "testing") - , mkBench "fill" (fill ' ') - , mkBench "hBoxFixed" (hBox [str "testing", str "testing"]) - , mkBench "vBoxFixed" (vBox [str "testing", str "testing"]) - , mkBench "hBoxUnlimited" (hBox [fill ' ', str "testing"]) - , mkBench "vBoxUnlimited" (vBox [fill ' ', str "testing"]) - , mkBench "empty" emptyWidget - , mkBench "hLimit" (hLimit 1 $ str "t") - , mkBench "vLimit" (vLimit 1 $ str "testing") - , mkBench "hCenter" (vBox $ take 1000 $ repeat $ hCenter $ str "testing") - - -- withDefaultAttr - -- withDefaultAttrName - -- withAttrName - -- withAttrMappings - -- forceAttr - -- raw - -- withBorderStyle - -- translateBy - -- cropLeftBy - -- cropRightBy - -- cropTopBy - -- cropBottomBy - -- showCursor - -- viewport - -- visible - -- visibleRegion - ] - ] - -main :: IO () -main = defaultMain allGroups diff --git a/src/Brick/Widgets/Core.hs b/src/Brick/Widgets/Core.hs index 1ba4b54..16d7b53 100644 --- a/src/Brick/Widgets/Core.hs +++ b/src/Brick/Widgets/Core.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} -- | This module provides the core widget combinators and rendering -- routines. Everything this library does is in terms of these basic -- primitives. @@ -83,11 +82,6 @@ module Brick.Widgets.Core -- * Misc , Direction(..) - -#ifdef BENCH - , renderFinal - , RenderState(..) -#endif ) where