annotate python/pydc/examples/sintest.py @ 0:0cfcc391201f

initial from svn dyncall-1745
author Daniel Adler
date Thu, 19 Mar 2015 22:26:28 +0100
parents
children bf5625bb6f05
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 import math
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2 import os
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 import pydc
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 def f1(n):
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 for x in xrange(n):
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 math.sin(x)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8 # filter( math.sin, range(0,n) )
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
9
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 libc = pydc.load("msvcrt")
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 fpsin = pydc.find(libc,"sin")
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14 def libcsin(x): pass
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 def f2(n):
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 for x in xrange(n):
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 pydc.call(fpsin,"d)d",float(x))
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 # libcsin(i)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 # filter( libcsin , range(0,n) )
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
23
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24 #b = os.times()
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25 f1(10000000)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
26 #f2(10000000)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27 e = os.times()
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
29 print e
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
30
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
31
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
32
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
33