本文整理汇总了Python中benchmark.Benchmark.title方法的典型用法代码示例。如果您正苦于以下问题:Python Benchmark.title方法的具体用法?Python Benchmark.title怎么用?Python Benchmark.title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类benchmark.Benchmark
的用法示例。
在下文中一共展示了Benchmark.title方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Benchmark
# 需要导入模块: from benchmark import Benchmark [as 别名]
# 或者: from benchmark.Benchmark import title [as 别名]
from benchmark import Benchmark
modules = ['numpy','Numeric','numarray']
b = Benchmark(modules,runs=3,reps=100)
N = 10000
b.title = 'Sorting %d elements' % N
b['numarray'] = ('a=np.array(None,shape=%d,typecode="i");a.sort()'%N,'')
b['numpy'] = ('a=np.empty(shape=%d, dtype="i");a.sort()'%N,'')
b['Numeric'] = ('a=np.empty(shape=%d, typecode="i");np.sort(a)'%N,'')
b.run()
N1,N2 = 100,100
b.title = 'Sorting (%d,%d) elements, last axis' % (N1,N2)
b['numarray'] = ('a=np.array(None,shape=(%d,%d),typecode="i");a.sort()'%(N1,N2),'')
b['numpy'] = ('a=np.empty(shape=(%d,%d), dtype="i");a.sort()'%(N1,N2),'')
b['Numeric'] = ('a=np.empty(shape=(%d,%d),typecode="i");np.sort(a)'%(N1,N2),'')
b.run()
N1,N2 = 100,100
b.title = 'Sorting (%d,%d) elements, first axis' % (N1,N2)
b['numarray'] = ('a=np.array(None,shape=(%d,%d), typecode="i");a.sort(0)'%(N1,N2),'')
b['numpy'] = ('a=np.empty(shape=(%d,%d),dtype="i");np.sort(a,0)'%(N1,N2),'')
b['Numeric'] = ('a=np.empty(shape=(%d,%d),typecode="i");np.sort(a,0)'%(N1,N2),'')
b.run()
示例2: Benchmark
# 需要导入模块: from benchmark import Benchmark [as 别名]
# 或者: from benchmark.Benchmark import title [as 别名]
from benchmark import Benchmark
modules = ["numpy", "Numeric", "numarray"]
b = Benchmark(modules, runs=3, reps=100)
N = 10000
b.title = "Sorting %d elements" % N
b["numarray"] = ('a=np.array(None,shape=%d,typecode="i");a.sort()' % N, "")
b["numpy"] = ('a=np.empty(shape=%d, dtype="i");a.sort()' % N, "")
b["Numeric"] = ('a=np.empty(shape=%d, typecode="i");np.sort(a)' % N, "")
b.run()
N1, N2 = 100, 100
b.title = "Sorting (%d,%d) elements, last axis" % (N1, N2)
b["numarray"] = ('a=np.array(None,shape=(%d,%d),typecode="i");a.sort()' % (N1, N2), "")
b["numpy"] = ('a=np.empty(shape=(%d,%d), dtype="i");a.sort()' % (N1, N2), "")
b["Numeric"] = ('a=np.empty(shape=(%d,%d),typecode="i");np.sort(a)' % (N1, N2), "")
b.run()
N1, N2 = 100, 100
b.title = "Sorting (%d,%d) elements, first axis" % (N1, N2)
b["numarray"] = ('a=np.array(None,shape=(%d,%d), typecode="i");a.sort(0)' % (N1, N2), "")
b["numpy"] = ('a=np.empty(shape=(%d,%d),dtype="i");np.sort(a,0)' % (N1, N2), "")
b["Numeric"] = ('a=np.empty(shape=(%d,%d),typecode="i");np.sort(a,0)' % (N1, N2), "")
b.run()