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
commit3f2a76b70815816b135c96cdfe4966fab4952214 (patch)
tree81c42ec09789c5615e57ba820b905f1e93a101e7 /speed.sh
parent5b48c520c1f4f408af9a0932b99da87b2ecf368a (diff)
downloadrsa-3f2a76b70815816b135c96cdfe4966fab4952214.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)'
+