-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Remove warnings - Update snap benchmarks to work with snap >= 0.3 - Separate benchmarks from criterion code
- Loading branch information
Showing
4 changed files
with
34 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
-- | This is a module which runs the 'HtmlBenchmarks' module using the different | ||
-- renderers available. | ||
-- | ||
module RunHtmlBenchmarks where | ||
|
||
import Criterion.Main | ||
import qualified Data.Text.Lazy as LT | ||
import qualified Data.ByteString.Lazy as LB | ||
|
||
import qualified Text.Blaze.Renderer.Utf8 as Utf8 | ||
import qualified Text.Blaze.Renderer.String as String | ||
import qualified Text.Blaze.Renderer.Text as Text | ||
|
||
import HtmlBenchmarks (HtmlBenchmark (..), benchmarks) | ||
|
||
-- | Function to run the benchmarks using criterion | ||
-- | ||
main :: IO () | ||
main = defaultMain $ concatMap benchHtml benchmarks | ||
where | ||
benchHtml (HtmlBenchmark name f x _) = | ||
[ bench (name ++ " (Utf8)") $ nf (LB.length . Utf8.renderHtml . f) x | ||
, bench (name ++ " (String)") $ nf (String.renderHtml . f) x | ||
, bench (name ++ " (Text)") $ nf (LT.length . Text.renderHtml . f) x | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters