Repository navigation
Improve flash usage for embedded targets - #176
Conversation
|
Hi, thanks for contributing. Can you explain your changes, what motivated exactly these changes, and any trade-offs to be aware of? |
|
The motivation comes from a need to decrease flash usage on the embedded project I'm working on. On my target is 16Kib / 256Kib ≈ 6% of the total space. For the first commit the only practical change is in the error format: you lose the info of the new satellite which is extra/overflowing. For the second commit, what occupies a lot of size is the std float parser, which I find to be too complex for this task. For example exponent notation is not allowed in NMEA. The new parser still allows non standard syntax (e.g. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #176 +/- ##
==========================================
- Coverage 82.86% 82.67% -0.19%
==========================================
Files 39 40 +1
Lines 1634 1680 +46
==========================================
+ Hits 1354 1389 +35
- Misses 280 291 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Sounds like a great change then. I have a few issues that we should resolve before merging:
|
CramBL
left a comment
There was a problem hiding this comment.
Much better 😄 just a small thing still
|
|
||
| /// Parse a plain decimal number into an `f64`, returning the number and the | ||
| /// number of input bytes consumed. | ||
| pub(crate) fn parse_f64_inner(input: &str) -> Result<(f64, usize), &'static str> { |
There was a problem hiding this comment.
It's only parse32 and parse64 that are actually used outside this module right? So can you leave them as the only functions with a pub qualifier?
|
Ok so now its cleaner with a separate module and more trustworthy with the added tests. The naming was initially taken from the Parser is not "correct" i a strict way, the rounding is off by a tiny amount measured to be a maximum of 4 ULP for 64 bit floats and 1 ULP for 32 bits, which seems to me acceptable given that the error is well below the precision of the actual measurement. Let me know if there is anything else to change |
Yes I noticed precision loss as well, but even though some receivers can output coordinates with 6 decimal precision, it is still not enough for 4 ULP to matter. 4 ULP would be less than a micron. I would still request a modification to the float module: Can you have the 2 functions used outside the module as |
|
I can move them at the top, but only |
Ah, yes, sorry, too many parse/float in this PR I misread it 😄 |
|
Thanks! |
CramBL
left a comment
There was a problem hiding this comment.
Wait I was too quick to approve. Can you fold the refactor commit into the feature commit so we don't have both the feature and the refactor of the same feature in the commit history on main?
This commit adds a new module for decimal parsing, alongside a fuzzing testsuite (using proptest).
|
@CramBL poke 👀 (did I miss any request?) |
No. I didn't get any notification to re-review. If you had clicked the "re-request review" button I would've looked at it 😄 |
|
Thanks! |
With those simple changes I've managed to save almost 16KiB on my embedded project.