# guard of main module added for forkserver and spawn start methods

import multiprocessing as mp            
from time import perf_counter as T

def count(n):
    while n>0:
        n -= 1

def main():        
    N = 100000000
    # serial 
    tic = T()
    count(N)
    count(N)
    toc = T()-tic
    print(f"         serial: {toc:.3f} seconds")

    #multiprocessing
    tic = T()
    t1 = mp.Process(target=count,args=(N,))
    t1.start()
    t2 = mp.Process(target=count,args=(N,))
    t2.start()
    t1.join()
    t2.join()
    toc = T()-tic
    print(f"multiprocessing: {toc:.3f} seconds")

if __name__=='__main__':
    main()

