Skip to content

Commit

Permalink
Add bench.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
ifduyue committed Dec 10, 2015
1 parent d68cbb3 commit 405c5c2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bench.sh
Original file line number Diff line number Diff line change
@@ -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)'

0 comments on commit 405c5c2

Please sign in to comment.