Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add benchmarks
- Loading branch information
Showing
3 changed files
with
31 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
^dist$ | ||
^(?:dist|benchmarks/dist)$ | ||
\.(?:aux|eventlog|h[ip]|log|[oa]|orig|prof|ps|swp)$ | ||
~$ | ||
syntax: glob | ||
|
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,16 @@ | ||
import Criterion.Main | ||
import qualified Data.ByteString.Base16 as B16 | ||
import qualified Data.ByteString as B | ||
|
||
generate :: Int -> B.ByteString | ||
generate n = B.pack . take n . cycle $ [0..255] | ||
|
||
main = defaultMain [ | ||
bgroup "encode" [ | ||
bench "8" $ whnf B16.encode (generate 8) | ||
, bench "32" $ whnf B16.encode (generate 32) | ||
, bench "128" $ whnf B16.encode (generate 128) | ||
, bench "1024" $ whnf B16.encode (generate 1024) | ||
, bench "65536" $ whnf B16.encode (generate 65536) | ||
] | ||
] |
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,14 @@ | ||
name: base15-bytestring-benchmarks | ||
version: 0 | ||
cabal-version: >= 1.8 | ||
build-type: Simple | ||
|
||
executable bm | ||
main-is: Benchmarks.hs | ||
|
||
build-depends: | ||
base, | ||
base16-bytestring, | ||
bytestring, | ||
criterion >= 0.5.0.10, | ||
text >= 0.11.0.8 |