# Collection of code snippets by Arne Vajhøj 
# (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import time
import psyco
def test():
  N = 1000000000
  sum = 0
  t1 = time.time()
  i = 0
  while i < N:
    sum = ((sum + 1) * 2 + 1) / 2
    i = i + 1
  t2 = time.time()
  if sum != N:
    print "error"
  else:
    print "%d operations in %d seconds" % (N, t2 - t1)
psyco.full()
test()
