Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch DataModel::Provider to a span-based list iterator - flash and ram savings, simpler interface #37033

Open
wants to merge 181 commits into
base: master
Choose a base branch
from

Conversation

andy31415
Copy link
Contributor

@andy31415 andy31415 commented Jan 10, 2025

The assumption here is that we always have sufficient heap (given that we have to handle sigma messages in the event loop and the metadata for things is generally reasonably small and can also be backed by static structures).

This is similar to #36889, however with a different approach (still using templates, however instead of pure iterators we have a concrete return list, which is likely to lead to simpler code because our existing design is often assuming flat lists).

Testing

  • Unit tests will be updated and generally integration tests should cover this quite well as well. No change in functionality is expected, only code layout.

  • New MetadataList class has extensive unit tests.

andreilitvin and others added 30 commits January 7, 2025 09:36
…y for expansion. This saves a tiny amount of flash (32 bytes)
… saves 8 bytes for struct. We still have a 20-byte padding which I am unsure how to get rid of
@andy31415 andy31415 requested a review from a team as a code owner January 17, 2025 15:53
Copy link

github-actions bot commented Jan 17, 2025

PR #37033: Size comparison from 4fd7215 to 12ad52c

Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section 4fd7215 12ad52c change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1093164 1092660 -504 -0.0
RAM 103362 103234 -128 -0.1
bl702 lighting-app bl702+eth FLASH 651226 650974 -252 -0.0
RAM 25365 25265 -100 -0.4
bl702+wifi FLASH 829150 828642 -508 -0.1
RAM 14105 13989 -116 -0.8
bl706+mfd+rpc+littlefs FLASH 1056180 1055928 -252 -0.0
RAM 23957 23853 -104 -0.4
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 889150 888642 -508 -0.1
RAM 18636 18512 -124 -0.7
lighting-app bl702l+mfd+littlefs FLASH 972164 971912 -252 -0.0
RAM 16484 16368 -116 -0.7
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 838436 838280 -156 -0.0
RAM 123536 123424 -112 -0.1
lock-ftd LP_EM_CC1354P10_6 FLASH 823832 823652 -180 -0.0
RAM 125416 125304 -112 -0.1
pump-app LP_EM_CC1354P10_6 FLASH 771112 770956 -156 -0.0
RAM 113908 113788 -120 -0.1
pump-controller-app LP_EM_CC1354P10_6 FLASH 755308 755144 -164 -0.0
RAM 114108 113996 -112 -0.1
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 538789 538753 -36 -0.0
RAM 205296 205176 -120 -0.1
lock CC3235SF_LAUNCHXL FLASH 572677 572649 -28 -0.0
RAM 205432 205312 -120 -0.1
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 679889 679801 -88 -0.0
RAM 78604 78492 -112 -0.1
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 699733 699645 -88 -0.0
RAM 81244 81124 -120 -0.1
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 699733 699645 -88 -0.0
RAM 81244 81124 -120 -0.1
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 656677 656589 -88 -0.0
RAM 73672 73560 -112 -0.2
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 616257 616129 -128 -0.0
RAM 71588 71476 -112 -0.2
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 635893 635765 -128 -0.0
RAM 74132 74028 -104 -0.1
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 635893 635765 -128 -0.0
RAM 74132 74028 -104 -0.1
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 635721 635609 -112 -0.0
RAM 74596 74476 -120 -0.2
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 655429 655317 -112 -0.0
RAM 77140 77028 -112 -0.1
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 655429 655317 -112 -0.0
RAM 77140 77028 -112 -0.1
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 612229 612101 -128 -0.0
RAM 68692 68572 -120 -0.2
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 632089 631961 -128 -0.0
RAM 71324 71204 -120 -0.2
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 632089 631961 -128 -0.0
RAM 71324 71204 -120 -0.2
efr32 lock-app BRD4187C FLASH 935080 935056 -24 -0.0
RAM 160004 159876 -128 -0.1
BRD4338a FLASH 730852 729860 -992 -0.1
RAM 234844 234744 -100 -0.0
window-app BRD4187C FLASH 1030520 1029512 -1008 -0.1
RAM 128112 127980 -132 -0.1
esp32 all-clusters-app c3devkit DRAM 95192 95072 -120 -0.1
FLASH 1538592 1538284 -308 -0.0
IRAM 82552 82552 0 0.0
m5stack DRAM 116172 116068 -104 -0.1
FLASH 1545810 1545986 176 0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4752 4752 0 0.0
FLASH 2710313 2708971 -1342 -0.0
RAM 133096 132656 -440 -0.3
all-clusters-app debug unknown 5560 5560 0 0.0
FLASH 5976378 5975324 -1054 -0.0
RAM 531880 531440 -440 -0.1
all-clusters-minimal-app debug unknown 5456 5456 0 0.0
FLASH 5324396 5323068 -1328 -0.0
RAM 242992 242520 -472 -0.2
bridge-app debug unknown 5472 5472 0 0.0
FLASH 4682624 4680778 -1846 -0.0
RAM 221744 221288 -456 -0.2
chip-tool debug unknown 5984 5984 0 0.0
FLASH 13045274 13044034 -1240 -0.0
RAM 596634 596178 -456 -0.1
chip-tool-ipv6only arm64 unknown 21816 21776 -40 -0.2
FLASH 11125760 11121344 -4416 -0.0
RAM 648168 647920 -248 -0.0
fabric-admin debug unknown 5808 5808 0 0.0
FLASH 11392249 11391009 -1240 -0.0
RAM 596978 596522 -456 -0.1
fabric-bridge-app debug unknown 4728 4728 0 0.0
FLASH 4507674 4506046 -1628 -0.0
RAM 208880 208456 -424 -0.2
fabric-sync debug unknown 4968 4968 0 0.0
FLASH 5610469 5608645 -1824 -0.0
RAM 483656 483216 -440 -0.1
lighting-app debug+rpc+ui unknown 6136 6136 0 0.0
FLASH 5617953 5615937 -2016 -0.0
RAM 232008 231584 -424 -0.2
lock-app debug unknown 5408 5408 0 0.0
FLASH 4732582 4730798 -1784 -0.0
RAM 207976 207536 -440 -0.2
ota-provider-app debug unknown 4768 4768 0 0.0
FLASH 4361282 4359394 -1888 -0.0
RAM 201696 201240 -456 -0.2
ota-requestor-app debug unknown 4720 4720 0 0.0
FLASH 4498956 4497134 -1822 -0.0
RAM 206280 205824 -456 -0.2
shell debug unknown 4248 4248 0 0.0
FLASH 3006765 3005437 -1328 -0.0
RAM 160736 160312 -424 -0.3
thermostat-no-ble arm64 unknown 9568 9528 -40 -0.4
FLASH 4102232 4098336 -3896 -0.1
RAM 246224 245952 -272 -0.1
tv-app debug unknown 5736 5736 0 0.0
FLASH 5950645 5949237 -1408 -0.0
RAM 607088 606648 -440 -0.1
tv-casting-app debug unknown 5312 5312 0 0.0
FLASH 11273101 11271373 -1728 -0.0
RAM 711064 710608 -456 -0.1
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 914772 914708 -64 -0.0
RAM 143176 143128 -48 -0.0
nrf7002dk_nrf5340_cpuapp FLASH 890116 889696 -420 -0.0
RAM 141363 141315 -48 -0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 849492 849428 -64 -0.0
RAM 142088 142040 -48 -0.0
nxp contact k32w0+release FLASH 584456 584320 -136 -0.0
RAM 70960 70836 -124 -0.2
mcxw71+release FLASH 600000 599808 -192 -0.0
RAM 63176 63056 -120 -0.2
light k32w0+release FLASH 611204 611100 -104 -0.0
RAM 70352 70236 -116 -0.2
k32w1+release FLASH 685744 685592 -152 -0.0
RAM 48768 48656 -112 -0.2
lock mcxw71+release FLASH 761776 761624 -152 -0.0
RAM 70788 70684 -104 -0.1
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1648060 1647116 -944 -0.1
RAM 211624 211528 -96 -0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1554628 1553668 -960 -0.1
RAM 208448 208344 -104 -0.0
light cy8ckit_062s2_43012 FLASH 1470172 1469148 -1024 -0.1
RAM 200416 200304 -112 -0.1
lock cy8ckit_062s2_43012 FLASH 1468028 1467068 -960 -0.1
RAM 224760 224648 -112 -0.0
qpg lighting-app qpg6105+debug FLASH 662560 662456 -104 -0.0
RAM 105296 105188 -108 -0.1
lock-app qpg6105+debug FLASH 620228 620140 -88 -0.0
RAM 99748 99632 -116 -0.1
stm32 light STM32WB5MM-DK FLASH 483240 483152 -88 -0.0
RAM 144752 144640 -112 -0.1
telink bridge-app tlsr9258a FLASH 682280 681952 -328 -0.0
RAM 91092 91044 -48 -0.1
contact-sensor-app tlsr9528a_retention FLASH 622460 622176 -284 -0.0
RAM 31492 31444 -48 -0.2
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 771348 771048 -300 -0.0
RAM 49352 49304 -48 -0.1
light-app-ota-shell-factory-data tl7218x FLASH 775952 775650 -302 -0.0
RAM 99656 99608 -48 -0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 709734 709400 -334 -0.0
RAM 73384 73336 -48 -0.1
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 626898 626660 -238 -0.0
RAM 142024 141976 -48 -0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 812962 812710 -252 -0.0
RAM 99568 99520 -48 -0.0
tizen all-clusters-app arm unknown 5132 5112 -20 -0.4
FLASH 1755320 1751120 -4200 -0.2
RAM 93680 93416 -264 -0.3
chip-tool-ubsan arm unknown 11044 11024 -20 -0.2
FLASH 18216926 18205534 -11392 -0.1
RAM 7958632 7951620 -7012 -0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants