summaryrefslogtreecommitdiff
path: root/speed.sh
diff options
context:
space:
mode:
authorYesudeep Mangalapilly <yesudeep@gmail.com>2011-08-11 12:03:37 +0530
committerYesudeep Mangalapilly <yesudeep@gmail.com>2011-08-11 12:03:37 +0530
commita5673890cec3d7518726b15d4cecc17c0b55aa4a (patch)
tree49e3c5294d511520ca12ef8a5b9df29dd6d2a8ca /speed.sh
parent7d73cf4398345824eaadf47e31f9c500c612a8b7 (diff)
downloadrsa-a5673890cec3d7518726b15d4cecc17c0b55aa4a.tar.gz
Adds speed tests for int2bytes and old_int2bytes.
* In the following tests, the first speed test for each version of Python checked is the new implementation and the second is the old implementation. $ ./speed.sh int2bytes speed test python2.5 1000 loops, best of 3: 315 usec per loop 100 loops, best of 3: 4.87 msec per loop python2.6 10000 loops, best of 3: 170 usec per loop 100 loops, best of 3: 3.34 msec per loop python2.7 10000 loops, best of 3: 169 usec per loop 100 loops, best of 3: 2.8 msec per loop python3.2 10000 loops, best of 3: 169 usec per loop 100 loops, best of 3: 3.16 msec per loop
Diffstat (limited to 'speed.sh')
-rwxr-xr-xspeed.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/speed.sh b/speed.sh
new file mode 100755
index 0000000..17f1ea4
--- /dev/null
+++ b/speed.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+echo "int2bytes speed test"
+echo "python2.5"
+python2.5 -mtimeit -s'from rsa.transform import int2bytes; n = 1<<4096' 'int2bytes(n)'
+python2.5 -mtimeit -s'from rsa.transform import old_int2bytes; n = 1<<4096' 'old_int2bytes(n)'
+echo "python2.6"
+python2.6 -mtimeit -s'from rsa.transform import int2bytes; n = 1<<4096' 'int2bytes(n)'
+python2.6 -mtimeit -s'from rsa.transform import old_int2bytes; n = 1<<4096' 'old_int2bytes(n)'
+echo "python2.7"
+python2.7 -mtimeit -s'from rsa.transform import int2bytes; n = 1<<4096' 'int2bytes(n)'
+python2.7 -mtimeit -s'from rsa.transform import old_int2bytes; n = 1<<4096' 'old_int2bytes(n)'
+echo "python3.2"
+python3 -mtimeit -s'from rsa.transform import int2bytes; n = 1<<4096' 'int2bytes(n)'
+python3 -mtimeit -s'from rsa.transform import old_int2bytes; n = 1<<4096' 'old_int2bytes(n)'