on ef0de4f help sign in
vty/test/BenchNoDiffOpt.hs
34 lines 911 B history raw
1{-# LANGUAGE BangPatterns #-}
2module BenchNoDiffOpt where
4{-# LANGUAGE BangPatterns #-}
5import Graphics.Vty
7import Control.Concurrent( threadDelay )
8import Control.Monad( liftM2 )
10import qualified Data.ByteString.Char8 as B
11import Data.List
13import System.Environment( getArgs )
14import System.IO
15import System.Random
17bench_0 = do
18 let fixed_gen = mkStdGen 0
19 setStdGen fixed_gen
20 vty <- mkVty
21 DisplayRegion w h <- display_bounds $ terminal vty
22 let image_0 = char_fill def_attr 'X' w h
23 let image_1 = char_fill def_attr '0' w h
24 flip_out vty 300 image_0 image_1
25 shutdown vty
27flip_out vty n image_0 image_1 =
28 let !p_left = pic_for_image image_0
29 !p_right = pic_for_image image_1
30 w_left 0 = return ()
31 w_left n = update vty p_left >> w_right (n-1)
32 w_right 0 = return ()
33 w_right n = update vty p_right >> w_left (n-1)
34 in w_left n