FLamparski / hzgrow-r502

Rust (embedded-hal) driver for the HZ Grow R502 capacitive fingerprint sensor
MIT License
16 stars 1 forks source link

Relatively large code size when compiled for thumbv7em #32

Open FLamparski opened 4 years ago

FLamparski commented 4 years ago

Some top items from cargo-bloat in an example stm32f4 project for this crate:

File  .text    Size                           Crate Name
0.0%   3.5%  1.6KiB                     hzgrow_r502 <hzgrow_r502::commands::Command as hzgrow_r502::utils::ToPayload>::to_payload
0.0%   3.5%  1.6KiB                   stm32f4xx_hal stm32f4xx_hal::rcc::CFGR::freeze
0.0%   2.6%  1.2KiB                     hzgrow_r502 hzgrow_r502::driver::R502<TX,RX>::parse_reply
0.0%   1.9%    884B                     hzgrow_r502 hzgrow_r502::driver::R502<TX,RX>::read_reply
0.0%   1.7%    816B                             std core::char::methods::<impl char>::encode_utf8
0.0%   1.7%    802B                             std core::str::slice_error_fail
0.0%   1.6%    728B                             std core::fmt::Formatter::pad
0.0%   1.5%    704B                     hzgrow_r502 hzgrow_r502::driver::R502<TX,RX>::send_command
0.0%   1.4%    670B stm32f446_fingerprint_detection stm32f446_fingerprint_detection::__cortex_m_rt_main

to_payload should clearly be improved here, also because of repetitive code therein.