core: limit message queue size
Currently there can be up to 32k items in a message queue on 16bit platforms, and up to 2 billion items on 32 bit platforms. I don't think this is reasonable.
I would limit the message queue to 128 items. This reduces the size of cib_t (which is used in tcb_t) from 12 bytes to 4 bytes (including padding) on 32bit platforms.
If you think that 128 message queue items is too restrictive (I doubt it), then we can restrict the message queue to 32k items, which would shrink cib_t to 8 bytes.
But I don't think that the current limit of MAXINT / 2 is reasonable. At least it hurts portability.
I agree that MAXINT / 2 is not reasonable for the message queue. I'm in doubt if 128 is enough for every use case.
Should I open a PR to limit the fields of cib_t to uint16_t now, and we can discuss if uint8_t might be enough later?
:+1:
It doesn't look like the change to uint16_t was ever implemented. Should I submit a PR for this?
I saw no one tackled this so I submitted a PR #2547
PR was merged prematurely
Imho, the performance aspect is more important here than saving some extra bytes of memory. I haven't testet it, but according to some posts on the internet accessing smaller datatypes (char, uint8_t, short,...) is slower than accessing unsigned/int on some 32-Bit ARM platforms - at least when unaligned. The current implementation looks good to me, I would rather leave it the way it is.
As this is marked as a "Newbie Task", please keep in mind integer conversion rules when refactoring: https://wiki.sei.cmu.edu/confluence/display/c/INT02-C.+Understand+integer+conversion+rules
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.
@kaspar030 do you think this is still an issue / should be fixed?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.
@kaspar030 ping?
No real engagement for over three years and there are doubts regarding the performance of such a memory optimization. Let's close it. Reopen if you disagree.