diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2016-10-27 19:39:39 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2016-10-27 19:39:39 (GMT) |
commit | ea28451286d3ea4a772fa174483f9a7a66bb1ab3 (patch) | |
tree | 6ee9d8a7848333a7ceeee3b13d492e40225f8b86 /tcllib/modules/ripemd/ripemd160.bench | |
parent | b5ca09bae0d6a1edce939eea03594dd56383f2c8 (diff) | |
parent | 7c621da28f07e449ad90c387344f07a453927569 (diff) | |
download | blt-ea28451286d3ea4a772fa174483f9a7a66bb1ab3.zip blt-ea28451286d3ea4a772fa174483f9a7a66bb1ab3.tar.gz blt-ea28451286d3ea4a772fa174483f9a7a66bb1ab3.tar.bz2 |
Merge commit '7c621da28f07e449ad90c387344f07a453927569' as 'tcllib'
Diffstat (limited to 'tcllib/modules/ripemd/ripemd160.bench')
-rw-r--r-- | tcllib/modules/ripemd/ripemd160.bench | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tcllib/modules/ripemd/ripemd160.bench b/tcllib/modules/ripemd/ripemd160.bench new file mode 100644 index 0000000..5ff52af --- /dev/null +++ b/tcllib/modules/ripemd/ripemd160.bench @@ -0,0 +1,46 @@ +# -*- tcl -*- +# Tcl Benchmark File +# +# This file contains a number of benchmarks for the 'ripemd' module. +# This allow developers to monitor/gauge/track package performance. +# +# (c) 2005 Andreas Kupries <andreas_kupries@users.sourceforge.net> + +# We need at least version 8.2 for the package and thus the +# benchmarks. + +if {![package vsatisfies [package provide Tcl] 8.2]} { + return +} + +# ### ### ### ######### ######### ######### ########################### +## Setting up the environment ... + +set moddir [file dirname [file dirname [info script]]] +lappend auto_path $moddir + +package forget ripemd +catch {namespace delete ::ripemd} +source [file join [file dirname [info script]] ripemd160.tcl] + +set key "01234567abcdefgh01234567abcdefgh01234567abcdefgh01234567abcdefgh==" + +# ### ### ### ######### ######### ######### ########################### +## Benchmarks. + +foreach n {1 10 100 1000 10000} { + bench -desc "RIPEMD 160 ripe $n" -pre { + set str [string repeat " " $n] + } -body { + ripemd::ripemd160 $str + } + + bench -desc "RIPEMD 160 hmac $n" -pre { + set str [string repeat " " $n] + } -body { + ripemd::hmac160 -key $key -- $str + } +} + +# ### ### ### ######### ######### ######### ########################### +## Complete |