diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-09-14 07:12:16 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-09-14 07:12:16 +0000 |
commit | 134da182130592c78bdb5d348826825665a2ffab (patch) | |
tree | e027490e3bb0f22bfcd5d826f7831c83ea929e2e /src/util/perf_crypto_hash.c | |
parent | 646e102680bff31286fa731aa5393f0eea19afe2 (diff) | |
download | gnunet-134da182130592c78bdb5d348826825665a2ffab.tar.gz gnunet-134da182130592c78bdb5d348826825665a2ffab.zip |
-also bench hash on small inputs
Diffstat (limited to 'src/util/perf_crypto_hash.c')
-rw-r--r-- | src/util/perf_crypto_hash.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/util/perf_crypto_hash.c b/src/util/perf_crypto_hash.c index 31af97b09..d61662dcc 100644 --- a/src/util/perf_crypto_hash.c +++ b/src/util/perf_crypto_hash.c | |||
@@ -43,6 +43,19 @@ perfHash () | |||
43 | 43 | ||
44 | 44 | ||
45 | static void | 45 | static void |
46 | perfHashSmall () | ||
47 | { | ||
48 | struct GNUNET_HashCode hc; | ||
49 | unsigned int i; | ||
50 | char buf[64]; | ||
51 | |||
52 | memset (buf, 1, sizeof (buf)); | ||
53 | for (i = 0; i < 1024; i++) | ||
54 | GNUNET_CRYPTO_hash (buf, sizeof (buf), &hc); | ||
55 | } | ||
56 | |||
57 | |||
58 | static void | ||
46 | perfHKDF () | 59 | perfHKDF () |
47 | { | 60 | { |
48 | unsigned int i; | 61 | unsigned int i; |
@@ -68,8 +81,14 @@ main (int argc, char *argv[]) | |||
68 | struct GNUNET_TIME_Absolute start; | 81 | struct GNUNET_TIME_Absolute start; |
69 | 82 | ||
70 | start = GNUNET_TIME_absolute_get (); | 83 | start = GNUNET_TIME_absolute_get (); |
84 | perfHashSmall (); | ||
85 | printf ("1024x 64-byte Hash perf took %s\n", | ||
86 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), | ||
87 | GNUNET_YES)); | ||
88 | |||
89 | start = GNUNET_TIME_absolute_get (); | ||
71 | perfHash (); | 90 | perfHash (); |
72 | printf ("Hash perf took %s\n", | 91 | printf ("1024x 64k Hash perf took %s\n", |
73 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), | 92 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (start), |
74 | GNUNET_YES)); | 93 | GNUNET_YES)); |
75 | GAUGER ("UTIL", "Cryptographic hashing", | 94 | GAUGER ("UTIL", "Cryptographic hashing", |