There are many trivial methods in the code that should be inlined (which will help compiler to generate better code).
Especially in cases like this:
|
fn encoded_fixed_size() -> Option<usize> { |
|
Some(mem::size_of::<$t>()) |
|
} |
This is essentially a const method, #[inline(force)] it will reduce the call and corresponding .unwrap() to a constant.
I wanted to submit such a change, but turned out code has a huge number of trivial methods and I wasn't in a mood to do invasive changes.
There are many trivial methods in the code that should be inlined (which will help compiler to generate better code).
Especially in cases like this:
parity-scale-codec/src/codec.rs
Lines 1545 to 1547 in 0a0295a
This is essentially a
constmethod,#[inline(force)]it will reduce the call and corresponding.unwrap()to a constant.I wanted to submit such a change, but turned out code has a huge number of trivial methods and I wasn't in a mood to do invasive changes.