Closed agmcleod closed 7 years ago
Hi. On my machine this program will either "hang" (debug mode, it's slow) or in release mode the operating system will kill it from using too much memory.
Note that there are 12! = 479 001 600 permutations, so it will need a lot of memory, around 60 GB on 64-bit; each Vec uses a 96-byte allocation and 24 bytes for itself! This code doesn't make sense to me, the program can't handle so many elements. I suggest you generate a smaller set of permutations.
Ah okay, yeah that makes sense. I realized it wasn't what i quite needed anyways, i needed permutations of each value by 2, not by every in the array. So was able to build that with a couple nested loops and a contains() check.
Running 0.2.2, it just seems to hang, not sure why. Trying where i used this for advent of code in 2015, it runs fine, though that seems to be using
Vec<&str>
, where here i'm usingVec<usize>