Caruychen / 42Hive-Lem_in

Integrated smart ant colony transport system
2 stars 0 forks source link

Bottlenecks #17

Closed crl-n closed 2 years ago

crl-n commented 2 years ago

I did some quick time profiling of the code. Here's a quick recap.

No quiet flag was used and generator was run with the --big-superposition flag. I modified the number of ants manually.

With a 100 ants the results looked like this.

image

Here's with a 1000 ants.

image

And 10 000 ants.

image

And finally 100 000 ants.

image

With a 100 000 ants the execution time is about 2 seconds. That doesn't seem too bad.

As you can see from the pictures, the bottleneck of the program depends on the amount of ants (and most likely the amount of nodes and paths, although this can't easily be adjusted). As the number of ants grow, the printer quickly becomes the bottleneck. I would say this is more or less expected, because increasing the number of ants mostly increases the workload for printer. Parsing and solving are probably affected more by the size of the and the number of connections in the graph.

Anyway, I just wanted to share that. I hope you find it helpful! In any case, this is a pretty good start, since it seems to already be fast enough to get us full points for the time complexity in the eval form. ⚡️