def getGenerationTimeForAllElementsLooped100Times(): startTime = time.time() allProducts = Box('AllProducts') scripts = ScriptContainer() allProducts.setScriptContainer(scripts) for x in xrange(100): doneSection() for product in Factory.products.keys(): allProducts.addChildElement( Factory.build(product, 'Test', 'Product')) instantiationTime = time.time() - startTime results['loopedInit'] = instantiationTime startTime = time.time() html = allProducts.toHtml() html += scripts.toHtml() generationTime = (time.time() - startTime) results['loopedToHtml'] = generationTime results['loopedToHtmlSize'] = len(html) results['loopedCreate'] = results['loopedInit'] + results['loopedToHtml']
def getGenerationTimeForAllElementsLooped100Times(): startTime = time.time() allProducts = Box('AllProducts') scripts = ScriptContainer() allProducts.setScriptContainer(scripts) for x in xrange(100): doneSection() for product in Factory.products.keys(): allProducts.addChildElement(Factory.build(product, 'Test', 'Product')) instantiationTime = time.time() - startTime results['loopedInit'] = instantiationTime startTime = time.time() html = allProducts.toHtml() html += scripts.toHtml() generationTime = (time.time() - startTime) results['loopedToHtml'] = generationTime results['loopedToHtmlSize'] = len(html) results['loopedCreate'] = results['loopedInit'] + results['loopedToHtml']