File: bench2.py

package info (click to toggle)
egenix-mx-base 3.2.8-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,420 kB
  • ctags: 6,208
  • sloc: ansic: 22,304; python: 18,124; sh: 137; makefile: 121
file content (27 lines) | stat: -rw-r--r-- 447 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import hack
import mx.Tools.NewBuiltins

a = trange(10000)

def f1():

    x = (a,a,a)
    for i in trange(100):
        x = lists(x)

def f2():

    x = (a,a,a)
    for i in trange(100):
        x = tuples(x)

def f3(apply=apply,map=map,tuple=tuple):

    x = (a,a,a)
    y = None
    for i in trange(100):
        x = apply(map,(y,)+tuple(x))

print 'lists:',hack.clock('f1()')
print 'tuples:',hack.clock('f2()')
print 'map:',hack.clock('f3()')