Performance boost

3 sec gain!
This commit is contained in:
2018-05-17 20:16:39 +02:00
parent c38de4b204
commit 5003ac0f4f

View File

@@ -5,14 +5,13 @@ import time
from datetime import date from datetime import date
def main(i, a, b): def main(i, a, b):
for x in range(0, int(i)): for x in range(0, i):
content = generateFile(a, b) writeFile(generateFile(a, b), x)
writeFile(content, x)
def generateFile(rows, lenghtOfRows): def generateFile(rows, lenghtOfRows):
content = [] content = []
for y in range(0, int(rows)): for y in range(0, rows):
content.append(generateRow(int(lenghtOfRows))) content.append(generateRow(lenghtOfRows))
return content return content
def generateRow(lenghtOfRows): def generateRow(lenghtOfRows):
@@ -27,9 +26,9 @@ def writeFile(content, x):
file.write(content[w] + "\n") file.write(content[w] + "\n")
print("Hello World") print("Hello World")
i = input("How many datapices would you like to generate?") i = int(input("How many datapices would you like to generate? "))
a = input("How many rows should each datapiece have?") a = int(input("How many rows should each datapiece have? "))
b = input("How long should each row be?") b = int(input("How long should each row be? "))
start_time = time.time() start_time = time.time()