Browse code

base64: add benchmark

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2012/01/21 06:45:51
Showing 1 changed files
... ...
@@ -159,11 +159,24 @@ int main(void)
159 159
         { "666666",  "NjY2NjY2"},
160 160
         { "abc:def", "YWJjOmRlZg=="},
161 161
     };
162
+    char in[1024], out[2048];
162 163
 
163 164
     printf("Encoding/decoding tests\n");
164 165
     for (i = 0; i < FF_ARRAY_ELEMS(tests); i++)
165 166
         error_count += test_encode_decode(tests[i].data, strlen(tests[i].data), tests[i].encoded_ref);
166 167
 
168
+    memset(in, 123, sizeof(in));
169
+    for(i=0; i<10000; i++){
170
+        START_TIMER
171
+        av_base64_encode(out, sizeof(out), in, sizeof(in));
172
+        STOP_TIMER("encode")
173
+    }
174
+    for(i=0; i<10000; i++){
175
+        START_TIMER
176
+        av_base64_decode(in, out, sizeof(in));
177
+        STOP_TIMER("decode")
178
+    }
179
+
167 180
     return error_count;
168 181
 }
169 182