Charge each held segment for its objects, at the measured cost, and file the held-message gap
Mirror / push (push) Successful in 6s
Test / lint (pull_request) Successful in 24s
Test / test (18) (pull_request) Successful in 38s
Test / test (20) (pull_request) Successful in 31s
Test / test (22) (pull_request) Successful in 32s
Test / test (24) (pull_request) Successful in 32s
Test / test (26) (pull_request) Successful in 33s

This commit is contained in:
2026-09-25 19:02:07 +02:00
parent 92456b6f6e
commit f9c53aa576
5 changed files with 33 additions and 20 deletions
+4 -3
View File
@@ -73,8 +73,9 @@ function detach(pduObj: PduObject): PduObject {
return { ...pduObj, params, shortMessageOctets: octets, tlvs };
}
// Roughly the heap a TLV or listed occurrence costs beyond its value, so a PDU of empty ones is not free.
const tlvObjectOverhead = 200;
// Measured heap beyond the octets, so a segment of empty fields or empty TLVs is not free.
const segmentObjectOverhead = 1000;
const tlvObjectOverhead = 300;
// A cstring param arrives as a string, and source_addr alone can carry most of a 1 MiB PDU.
function sizeOf(value: ParamValue): number {
@@ -84,7 +85,7 @@ function sizeOf(value: ParamValue): number {
}
function octetsOf(pduObj: PduObject): number {
let octets = 0;
let octets = segmentObjectOverhead;
for (const value of Object.values(pduObj.params)) {
octets += sizeOf(value);