War simulator in Python
war.py
python war.py *times*
warOne.py (All simulations done in a single, multidimensional array.)
python warOne.py *times*
warThread.py (Simulations are distributed across processes):
python warThread.py *times*
Type | 100 sims | 1000 sims | 5000 sims | 10000 sims |
---|---|---|---|---|
War | 1.42 s | 14.20 s | 73.54 s | 146.60 s |
WarOne | 1.39 s | 15.91 s | 75.07 s | 153.93 s |
WarThread | 0.84 s | 5.66 s | 23.82 s | 49.62 s |
Type | 100 sims | 1000 sims | 5000 sims | 10000 sims |
---|---|---|---|---|
War | 0.58s | 5.18 s | 25.17 s | 49.63 s |
WarOne | 0.47 s | 5.44 s | 25.54 s | 53.45 s |
WarThread | 0.42 s | 1.53 s | 6.76 s | 14.33 s |
- 50000: 70.41 s
- 100000: 138.25 s
Type | 100 sims | 1000 sims | 5000 sims | 10000 sims |
---|---|---|---|---|
War | 0.98 s | 10.64 s | 51.97 s | 104.03 s |
WarOne | 1.06 s | 11.28 s | 56.20 s | 106.88 s |
WarThread | 0.27 s | 1.51 s | 6.69 s | 13.61 s |
- 50000: 66.38s
- 100000: 131.56s
The same code written in C++ to test compiled vs interpretted code
Type | 100 sims | 1000 sims | 5000 sims | 10000 sims | 100000 sims |
---|---|---|---|---|---|
War | 0.03 s | .36 s | 1.97 s | 4.86 s | 56.118 s |