# Licensed to the .NET Foundation under one or more agreements.# The .NET Foundation licenses this file to you under the Apache 2.0 License.# See the LICENSE file in the project root for more information.""" This provides a more convenient harness for running thisbenchmark and collecting separate timings for each component."""from time import clockimport sys, ossys.path.append(os.path.join([os.environ[x] for x in list(os.environ.keys()) if x.lower() == "dlr_root"][0], "Languages", "IronPython", "External", "parrotbench"))if sys.implementation.name=="ironpython":import Systemis_cli64 = System.IntPtr.Size == 8if is_cli64:print("CodePlex 18518")sys.exit(0)def test_main(type="short"):oldRecursionDepth = sys.getrecursionlimit()try:sys.setrecursionlimit(1001)t0 = clock()import b0import b1import b2import b3import b4import b5import b6print('import time = %.2f' % (clock()-t0))tests = [b0,b1,b2,b3,b4,b5,b6]N = { "short" : 1, "full" : 1, "medium" : 2, "long" : 4 }[type]results = {}t0 = clock()for i in range(N):for test in tests:ts0 = clock()test.main()tm = (clock()-ts0)results.setdefault(test, []).append(tm)print('%.2f sec running %s' % ( tm, test.__name__))for test in tests:print('%s = %f -- %r' % (test.__name__, sum(results[test])/N, results[test]))print('all done in %.2f sec' % (clock()-t0))finally:sys.setrecursionlimit(oldRecursionDepth)if __name__=="__main__":kind = "short"if len(sys.argv) > 1: kind = sys.argv[1]test_main(kind)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。