#!/usr/bin/python3

import threading
import time

def f(): #a minimal function that just does some CPU bound work
    s = 0;
    while s < 10000000: #count first 10 million numbers
        s += 1

start1 = time.time() #when we started
f() #do it unthreaded
print("unthreaded needed " +str(time.time() -start1))


start1 = time.time() #when we started
x = threading.Thread(target = f) 
x.start()
x.join()
print("as a single thread " +str(time.time() -start1))

start1 = time.time() #when we started
x = threading.Thread(target = f) 
y = threading.Thread(target = f)
z = threading.Thread(target = f)
x.start()
y.start()
z.start()
x.join()
y.join()
z.join()
print("three threads needed " +str(time.time() -start1))
