From 405c5c2cd764d5f32ff988e185734ef29f3c4cc5 Mon Sep 17 00:00:00 2001 From: Yue Du Date: Thu, 10 Dec 2015 15:12:40 +0800 Subject: [PATCH] Add bench.sh --- bench.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 bench.sh diff --git a/bench.sh b/bench.sh new file mode 100755 index 0000000..709402d --- /dev/null +++ b/bench.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +PYTHON=${PYTHON-`which python`} + +echo -n " encrypt: " +$PYTHON -mtimeit -s 'import xxtea' -s 'import os' -s 'key = os.urandom(16)' -s 'data = os.urandom(1000)' 'xxtea.encrypt(data, key)' + +echo -n " decrypt: " +$PYTHON -mtimeit -s 'import xxtea' -s 'import os' -s 'key = os.urandom(16)' -s 'data = xxtea.encrypt(os.urandom(1000), key)' 'xxtea.decrypt(data, key)' + +echo -n "encrypt_hex: " +$PYTHON -mtimeit -s 'import xxtea' -s 'import os' -s 'key = os.urandom(16)' -s 'data = os.urandom(1000)' 'xxtea.encrypt_hex(data, key)' + +echo -n "decrypt_hex: " +$PYTHON -mtimeit -s 'import xxtea' -s 'import os' -s 'key = os.urandom(16)' -s 'data = xxtea.encrypt_hex(os.urandom(1000), key)' 'xxtea.decrypt_hex(data, key)'