old_contents: # zwei 12/17/13
  # subscribe simple generator
  import time
  
  def gen(n):
  	for i in range(n):
  		yield i
  
  def call_generator(num, iteration):
  
  	for t in range(iteration):
  		for i in gen(num):
  			item = i
  
  	return item
  
  
  def measure():
  	print("Start timing...")
  	start = time.time()
  
  	num = 1000
  	last_item = call_generator(num, 100000) #1000000
  
  	print("Last item ", last_item)
  
  	duration = "%.3f\n" % (time.time() - start)
  	print("generator: " + duration)
  
  #warm up
  for run in range(1000):
  	call_generator(10, 10000)
  
  measure()
new_contents: # zwei 12/17/13
  # subscribe simple generator
  import time
  
  def generator(n):
  	for i in range(n):
  		yield i * 2
  
  def call_generator(num, iteration):
  	item = 0
  	for t in range(iteration):
  		num += t % 5
  		for i in generator(num):
  			item = i + item % 5
  
  	return item
  
  
  def measure():
  	print("Start timing...")
  	start = time.time()
  
  	num = 1000
  	last_item = call_generator(num, 10000) #1000000
  
  	print("Last item ", last_item)
  
  	duration = "%.3f\n" % (time.time() - start)
  	print("generator: " + duration)
  
  #warm up
  for run in range(1000):
  	call_generator(10, 100)
  
  measure()
subject: Update micro benchmark: generator; Add more loop variant instruction to the hot loop