fork(3) download
  1. import time
  2. import dis
  3.  
  4.  
  5. counts = 3000000
  6.  
  7. def at_once():
  8. first = 0
  9. second = 0
  10. third = 0
  11. x = 0
  12. while x < counts:
  13. x += 1
  14. exec_first = time.time() - time.time()
  15. exec_second = time.time() - time.time()
  16.  
  17. if exec_first > exec_second:
  18. first += 1
  19. elif exec_second > exec_first:
  20. second += 1
  21. else:
  22. third += 1
  23.  
  24. print('1sts: %s' % first)
  25. print('2nds: %s' % second)
  26. print('3rds: %s' % third)
  27.  
  28. at_once()
Success #stdin #stdout 1.46s 29768KB
stdin
Standard input is empty
stdout
1sts: 2602658
2nds: 121269
3rds: 276073