lib: improve lazy loading
The function call plus the existence check is more expensive than inlining the lazy require.
A few lazyAssert calls were obsolete as the assert would have to be required before.
I also moved a few lazy requires in the specific code path as it would not be required at all in some cases.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
Affected core subsystem(s)
lib