1.1 --- a/examples/simple_start.py Sat Sep 15 19:41:49 2007 +0000
1.2 +++ b/examples/simple_start.py Sat Sep 15 19:42:24 2007 +0000
1.3 @@ -18,8 +18,8 @@
1.4 def calculate(ch, i, j):
1.5
1.6 """
1.7 - A time-consuming calculation, using 'ch' to communicate with the parent
1.8 - process, with 'i' and 'j' as operands.
1.9 + A supposedly time-consuming calculation on 'i' and 'j', using 'ch' to
1.10 + communicate with the parent process.
1.11 """
1.12
1.13 time.sleep(delay)
1.14 @@ -37,16 +37,17 @@
1.15
1.16 if __name__ == "__main__":
1.17
1.18 + t = time.time()
1.19 +
1.20 # Initialise the communications exchange with a limit on the number of
1.21 # channels/processes.
1.22
1.23 exchange = MyExchange(limit=limit)
1.24 - t = time.time()
1.25
1.26 # Initialise an array - it is stored in the exchange to permit automatic
1.27 # assignment of values as the data arrives.
1.28
1.29 - exchange.D = [0] * N * N
1.30 + results = exchange.D = [0] * N * N
1.31
1.32 # Perform the work.
1.33
1.34 @@ -62,10 +63,11 @@
1.35
1.36 # Show the results.
1.37
1.38 - print "Time taken:", time.time() - t
1.39 for i in range(0, N):
1.40 - for result in exchange.D[i*N:i*N+N]:
1.41 + for result in results[i*N:i*N+N]:
1.42 print result,
1.43 print
1.44
1.45 + print "Time taken:", time.time() - t
1.46 +
1.47 # vim: tabstop=4 expandtab shiftwidth=4