[x-post from users forum] Long compile times for a vector with 50K u64 values

This is my first post in this forum, so apologies if I make any mistakes.

This is a cross-post from this post at the users forum.

"Hi guys, I'm trying to write a program where a large vector of u64's, with about 53000 elements of predefined values, needs to be stored and used. However, the program takes a long time to compile, about 24 seconds on my Ryzen 2700X machine. It was taking 47 seconds previously if I tried assigning the values after creating the matrices Vector.

I felt these compile times are rather long for such a program, so I wanted to ask your opinion. I've created a semi-barebones repository here 1. Just trying to compile this should take a while.

So I wanted to ask:

  1. Is this compile times expected for this given scenario?
  2. If not, is there any way to speed up the compilation? For example, the same code in C++ takes much less time to compile.

Thanks in advance!"

Some additional information:

  1. This vec is completely precomputed, so no calculation needs to be done at compile or run-time. It is basically loading 53K u64 values into a vector for storage and lookup for calculations.
  2. While it seems reasonable to store the values in a file, and read from them, this use-case might be of interest to the internals or the relevant team here.

Thanks in advance for your time!

1 Like

This is a bug: https://github.com/rust-lang/rust/issues/39352

1 Like