]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.2/Lib/test/time_hashlib.py
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Lib / test / time_hashlib.py
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Lib/test/time_hashlib.py b/AppPkg/Applications/Python/Python-2.7.2/Lib/test/time_hashlib.py
deleted file mode 100644 (file)
index 3fee8f4..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-# It's intended that this script be run by hand.  It runs speed tests on\r
-# hashlib functions; it does not test for correctness.\r
-\r
-import sys, time\r
-import hashlib\r
-\r
-\r
-def creatorFunc():\r
-    raise RuntimeError, "eek, creatorFunc not overridden"\r
-\r
-def test_scaled_msg(scale, name):\r
-    iterations = 106201/scale * 20\r
-    longStr = 'Z'*scale\r
-\r
-    localCF = creatorFunc\r
-    start = time.time()\r
-    for f in xrange(iterations):\r
-        x = localCF(longStr).digest()\r
-    end = time.time()\r
-\r
-    print ('%2.2f' % (end-start)), "seconds", iterations, "x", len(longStr), "bytes", name\r
-\r
-def test_create():\r
-    start = time.time()\r
-    for f in xrange(20000):\r
-        d = creatorFunc()\r
-    end = time.time()\r
-\r
-    print ('%2.2f' % (end-start)), "seconds", '[20000 creations]'\r
-\r
-def test_zero():\r
-    start = time.time()\r
-    for f in xrange(20000):\r
-        x = creatorFunc().digest()\r
-    end = time.time()\r
-\r
-    print ('%2.2f' % (end-start)), "seconds", '[20000 "" digests]'\r
-\r
-\r
-\r
-hName = sys.argv[1]\r
-\r
-#\r
-# setup our creatorFunc to test the requested hash\r
-#\r
-if hName in ('_md5', '_sha'):\r
-    exec 'import '+hName\r
-    exec 'creatorFunc = '+hName+'.new'\r
-    print "testing speed of old", hName, "legacy interface"\r
-elif hName == '_hashlib' and len(sys.argv) > 3:\r
-    import _hashlib\r
-    exec 'creatorFunc = _hashlib.%s' % sys.argv[2]\r
-    print "testing speed of _hashlib.%s" % sys.argv[2], getattr(_hashlib, sys.argv[2])\r
-elif hName == '_hashlib' and len(sys.argv) == 3:\r
-    import _hashlib\r
-    exec 'creatorFunc = lambda x=_hashlib.new : x(%r)' % sys.argv[2]\r
-    print "testing speed of _hashlib.new(%r)" % sys.argv[2]\r
-elif hasattr(hashlib, hName) and callable(getattr(hashlib, hName)):\r
-    creatorFunc = getattr(hashlib, hName)\r
-    print "testing speed of hashlib."+hName, getattr(hashlib, hName)\r
-else:\r
-    exec "creatorFunc = lambda x=hashlib.new : x(%r)" % hName\r
-    print "testing speed of hashlib.new(%r)" % hName\r
-\r
-try:\r
-    test_create()\r
-except ValueError:\r
-    print\r
-    print "pass argument(s) naming the hash to run a speed test on:"\r
-    print " '_md5' and '_sha' test the legacy builtin md5 and sha"\r
-    print " '_hashlib' 'openssl_hName' 'fast' tests the builtin _hashlib"\r
-    print " '_hashlib' 'hName' tests builtin _hashlib.new(shaFOO)"\r
-    print " 'hName' tests the hashlib.hName() implementation if it exists"\r
-    print "         otherwise it uses hashlib.new(hName)."\r
-    print\r
-    raise\r
-\r
-test_zero()\r
-test_scaled_msg(scale=106201, name='[huge data]')\r
-test_scaled_msg(scale=10620, name='[large data]')\r
-test_scaled_msg(scale=1062, name='[medium data]')\r
-test_scaled_msg(scale=424, name='[4*small data]')\r
-test_scaled_msg(scale=336, name='[3*small data]')\r
-test_scaled_msg(scale=212, name='[2*small data]')\r
-test_scaled_msg(scale=106, name='[small data]')\r
-test_scaled_msg(scale=creatorFunc().digest_size, name='[digest_size data]')\r
-test_scaled_msg(scale=10, name='[tiny data]')\r