martin-t / cvars

Configuration variables and consoles for games in Rust. An alternative to inline_tweak / const-tweaker with different tradeoffs.

Home Page:https://docs.rs/cvars/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compile times

martin-t opened this issue · comments

Switch to a hashmap or trie for storing the strings, the generated match is huge:

cargo llvm-lines:

  Lines          Copies       Function name
  -----          ------       -------------
  119771 (100%)  4182 (100%)  (TOTAL)
   30067 (25.1%)    1 (0.0%)  rec_wars::cvars::Cvars::set_str
    5892 (4.9%)     1 (0.0%)  rec_wars::cvars::Cvars::get_string
    3083 (2.6%)     1 (0.0%)  rec_wars::rendering::render_viewport

and render_viewport is a huge 700 line function.

Maybe llvm lines are not the best metric but it absolutely does add a lot to compile times (test with SetGetDummy)

Made some improvements, rebuild times are acceptable up to 1k cvars.

Waiting for offset_of to to stabilized so we can reasonably support up to 10k cvars.