I ran cargo flamegraph and noticed that core::fmt::num::imp::_<impl core::fmt::Display for i32>::fmt take about 20% of the time though I don't even use i32 in my code.
The flamegraph should show you what intermediate functions are formatting i32s (although it can be non-obvious in the code, hidden behind println! and format! macros). You aren't printing any numbers at all?
Because to_string is generic, it goes through a few layers of formatting code, which might not all get optimized away. And it allocates a new String for each conversion, which also adds overhead.
Even optimized string conversions are surprisingly slow, and to_string needs to allocate, which does have cost. (Things like write!(f, "foo: {}", bar.to_string()), in particular, are a bad idea because of the intermediate steps.)
Good to know... So this itoa crate could be useful when having do display numbers in a game.
I already have so many dependencies. Anyway: this one was solved. I will complain somewhere else if needed
If you were having performance issues with displaying numbers, one thing you might do is write a std::fmt::Write implementation such that you can write the characters making up formatted values directly into your text-renderer, without going through String allocation.
Not saying you should necessarily do that, just that it's an option, and using the built-in formatter does not necessarily imply allocating.