summaryrefslogtreecommitdiff
path: root/speed.sh
diff options
context:
space:
mode:
authorYesudeep Mangalapilly <yesudeep@gmail.com>2011-08-12 15:29:31 +0530
committerYesudeep Mangalapilly <yesudeep@gmail.com>2011-08-12 15:29:31 +0530
commitce4ede758d0c0a35925e4c1f4184ca06027baa91 (patch)
tree81c42ec09789c5615e57ba820b905f1e93a101e7 /speed.sh
parentc4b431446b326fd3739eb0770dcec3226c55eadb (diff)
downloadrsa-git-ce4ede758d0c0a35925e4c1f4184ca06027baa91.tar.gz
Adds speed tests for bit_size.
* bit_size is at least 28x faster than the original implementation and generally fares in and around 10 microseconds where as the older one does around 1.8 milliseconds.
Diffstat (limited to 'speed.sh')
-rwxr-xr-xspeed.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/speed.sh b/speed.sh
index a2c4014..02aeb25 100755
--- a/speed.sh
+++ b/speed.sh
@@ -17,3 +17,20 @@ echo "pypy"
pypy -mtimeit -s'from rsa.transform import int2bytes; n = 1<<4096' 'int2bytes(n)'
pypy -mtimeit -s'from rsa.transform import _int2bytes; n = 1<<4096' '_int2bytes(n)'
+echo "bit_size speed test"
+echo "python2.5"
+python2.5 -mtimeit -s'from rsa.common import bit_size; n = 1<<4096' 'bit_size(n)'
+python2.5 -mtimeit -s'from rsa.common import _bit_size; n = 1<<4096' '_bit_size(n)'
+echo "python2.6"
+python2.6 -mtimeit -s'from rsa.common import bit_size; n = 1<<4096' 'bit_size(n)'
+python2.6 -mtimeit -s'from rsa.common import _bit_size; n = 1<<4096' '_bit_size(n)'
+echo "python2.7"
+python2.7 -mtimeit -s'from rsa.common import bit_size; n = 1<<4096' 'bit_size(n)'
+python2.7 -mtimeit -s'from rsa.common import _bit_size; n = 1<<4096' '_bit_size(n)'
+echo "python3.2"
+python3 -mtimeit -s'from rsa.common import bit_size; n = 1<<4096' 'bit_size(n)'
+python3 -mtimeit -s'from rsa.common import _bit_size; n = 1<<4096' '_bit_size(n)'
+echo "pypy"
+pypy -mtimeit -s'from rsa.common import bit_size; n = 1<<4096' 'bit_size(n)'
+pypy -mtimeit -s'from rsa.common import _bit_size; n = 1<<4096' '_bit_size(n)'
+