Skip to content

2. Part 1: deterministic latency

Measured on an SMLIGHT SLZB-06P7 (CC2652P7 / CC1352P7 @ 48 MHz) via the Cortex-M4F DWT->CYCCNT cycle counter (20.83 ns resolution, 1 µs = 48 cycles). Load axes: S ∈ [0, 299] peer slots, D ∈ [0, 256] NVM flash log depth, k ∈ [0, 64] heap-fragmentation holes, T ∈ [0, 39] active timers, and Q ∈ [0, 64] queued task messages.

Subsystem / operation (mesh scale D=150..300) Stock TI Z-Stack (DWT->CYCCNT) SMLIGHT ZeroStack (v1.0.0) Measured speedup / scaling law
TCLK lookup miss (300-entry table, first contact) 1,486,228 cyc (30.96 ms) 326 cyc (6.8 µs), 0 flash reads 4,559× faster (O(1) against O(N⋅P))
TCLK lookup hit (300-entry table, oldest record, age 383) 620,396 cyc (12.92 ms) 324 cyc (6.75 µs), 0 flash reads 1,915× faster (Slot 0 fresh: 7.1×, Slot 299 fresh: 9.1×)
Per-frame NWK security: encrypt (D=150) 533,156 cyc (11.11 ms) 3,968 cyc (82.7 µs), 0 flash reads 134.4× faster (O(1) flat, 2.15× at D=0)
Per-frame NWK security: decrypt (D=150) 532,182 cyc (11.09 ms) 3,824 cyc (79.7 µs), 0 flash reads 139.2× faster (O(1) flat)
Routed hop security ceiling (D=150, decrypt + encrypt) 1,065,338 cyc (22.19 ms, ~45 pkt/s max) 7,792 cyc (162 µs, >6,100 pkt/s max) 135× higher routed packet ceiling
Per-frame APS TX security (300-peer table, D=0..100) 52,909 – 409,301 cyc (up to 8.53 ms) 5,410 – 5,424 cyc (113 µs) Up to 75.5× faster
Device authentication check (Slot 0 → 299) 1,656 → 42,243 cyc (up to 880 µs) 181 → 179 cyc (3.7 µs) Up to 236× faster
NVM stack key read (D = 0 → 150) 2,347 → 64,817 cyc (up to 1.35 ms) 302 – 303 cyc (6.3 µs) Up to 213.9× faster
Idempotent NVM state write (unchanged 100 B record) 100,714 cyc (2.10 ms), writes flash 48/48 times 3,770 cyc (78.5 µs), 0 B flash writes 48/48 26.7× faster plus 0% unnecessary flash wear
NVM flash compaction frequency and stall First compaction at write #69 First compaction at write #1,013 (13.7 ms stall) 14.7× lower compaction rate
Dynamic memory allocation (malloc, k=64 holes) 2,550 cyc (53.1 µs, O(k) hole walk) 218 cyc (4.5 µs, O(1)) 11.7× faster
Timer start (T=39 timers, 64 heap holes) 10,034 cyc (209.0 µs, heap-coupled) 1,448 cyc (30.2 µs, heap-independent) 6.9× faster
Inter-task event enqueue (msgSend, Q=64) 935 cyc (19.5 µs, O(Q) walk) 322 cyc (6.7 µs, O(1) flat) 2.9× faster
Host serial SYS_PING round trip 9,790 cyc total, 4,921 cyc reply path 4,618 cyc total, 816 cyc reply path 53% fewer total cycles, 83% fewer on the reply path

Stock Z-Stack stores keys and network state in an append-only flash log and scans backward to locate the active entry. Read latency scales linearly with the number of newer records written after the target item.

Operation / workload Stock TI Z-Stack SMLIGHT ZeroStack Hardware analysis
Stack key read (D = 0, fresh log) 2,347 (48.9 µs) 302 (6.3 µs) 7.8× faster, even with the record at the very top of flash.
Stack key read (D = 150 newer records) 64,817 (1.35 ms, +416 per record) 303 (6.3 µs) 213.9× faster. Strictly O(1). Stock cost scales linearly with flash traffic.
Write unchanged data (2 B / 20 B / 100 B) 19.1k / 35.3k / 100.7k cyc 2.0k / 2.3k / 3.8k cyc Up to 26.7× faster. ZeroStack writes 0 bytes when data is unchanged (48/48 writes, stock appended on 48/48).
Write changed data (2 B / 20 B / 100 B) 19.1k / 35.4k / 102.2k 20.1k / 37.0k / 104.8k Physical flash programming dominates when bytes really change (+3–5% for integrity verification).
General item read (D = 0..256) 581 – 14,303 (flash walk) 1,696 – 1,724 (flat) Flat regardless of log position.
First flash page compaction Write #69 Write #1,013 14.7× more mutations before compaction, and no wear on idempotent writes.

Trust Center Link Key resolution (300-entry table)

Section titled “Trust Center Link Key resolution (300-entry table)”

Every frame of a BDB 3.1 key exchange (Request-Key, Transport-Key, Verify-Key, Confirm-Key) resolves the joining device’s key. Stock Z-Stack finds the entry with a content match over the non-volatile log, walking record headers from the newest backwards. A device with no key yet costs a walk of the whole log.

Lookup scenario Stock TI Z-Stack (cycles / time) SMLIGHT ZeroStack (cycles / time) Measured speedup
Hit, newest record (Slot 0) 2,961 – 2,963 (61.7 µs) 417 (8.7 µs) 7.1× faster
Hit, newest record (Slot 299) 2,962 – 2,963 (61.7 µs) 324 (6.75 µs) 9.1× faster
Hit, oldest record measured (age 383) 620,396 (12.92 ms) 324 (6.75 µs) 1,915× faster
Miss, full 300-entry table (first contact) 1,486,228 (30.96 ms) 326 (6.8 µs) 4,559× faster

ZeroStack holds every measured TCLK lookup at or below 9 µs regardless of flash write history. Stock Z-Stack spends tens of milliseconds per joining device scanning flash for key entries.

Every packet on a secured mesh runs AES-128-CCM* at the NWK layer, and APS-encrypted payloads add a second AES-128-CCM* pass. On CC1352P7, the hardware AES engine executes the raw block cipher in microseconds; on stock Z-Stack, end-to-end security latency is dominated by flash log walks for key fetches and linear address-table scans rather than AES execution.

Security workload Stock TI Z-Stack SMLIGHT ZeroStack Operational impact
NWK encrypt (D = 0) 8,558 (178.3 µs) 3,980 (82.9 µs) 2.15× faster at zero flash depth.
NWK encrypt (D = 150) 533,156 (11.11 ms) 3,968 (82.7 µs) 134.4× faster. Strictly flat, 0 flash reads per packet.
NWK decrypt (D = 0) 8,091 (168.6 µs) 3,840 (80.0 µs) 2.11× faster at zero flash depth.
NWK decrypt (D = 150) 532,182 (11.09 ms) 3,824 (79.7 µs) 139.2× faster. Stock caps at ~45 routed pkt/s against >6,100 pkt/s (162 µs per hop).
APS TX encrypt (Slot 0 → 299, D=0..100) 52,909 → 409,301 (8.53 ms) 5,410 → 5,424 (0.113 ms) Up to 75.5× faster, invariant to flash log order.
Device authentication check (Slot 0 → 299) 1,656 → 42,243 (880 µs) 181 → 179 (3.7 µs) 236× faster at 300 nodes. Flat by slot (stock ~136 cycles per slot).

Forwarding one routed packet needs one NWK decrypt on receive and one NWK encrypt on transmit. At D=150 stock Z-Stack spends 22.19 ms of CPU per hop (532k + 533k cycles), which limits forwarding to about 45 packets per second before the CPU is at 100% on NWK security alone. ZeroStack completes the same cycle in 162 µs (7,792 cycles).

Dynamic memory allocation under fragmentation

Section titled “Dynamic memory allocation under fragmentation”

A single-list first-fit heap scans from the base of the heap on every allocation. Long-lived indirect buffers or timers pin intermediate addresses, and k small holes accumulate at the front. ZeroStack’s allocator completes requests in constant time regardless of k.

Heap state Stock TI Z-Stack (malloc / free) SMLIGHT ZeroStack (malloc / free) Speedup
Unfragmented (k = 0) 310 / 84 cyc 225 / 200 cyc 1.38× baseline allocation
Light (k = 16) 869 / 82 cyc 218 / 175 cyc 3.99×
Moderate (k = 32) 1,430 / 82 cyc 220 / 175 cyc 6.50×
Heavy (k = 64) 2,550 / 82 cyc (~35 cyc per hole) 218 / 175 cyc (0 cyc per hole) 11.7× (O(1) constant time)

free is slightly cheaper on the stock stack (82–84 against 175–200 cycles) because the stock allocator defers its bookkeeping to the next malloc walk, which is where its O(k) cost appears.

On the stock stack, starting a timer allocates its timer entry and its kernel clock object from the general heap (64 bytes per timer, measured), so a fragmented heap costs the O(k) scan twice. The stock msgSend walks the target task’s linked list. ZeroStack timer latency does not depend on heap state and its enqueue latency stays flat.

Operation Stock TI Z-Stack SMLIGHT ZeroStack Speedup / notes
Timer start (T = 0 → 39, clean heap) 2,652 → 5,844 cyc 912 → 1,447 cyc 4.04× at 39 timers (stock performs 2 heap allocations per start).
Timer start (T = 0 → 39, 64 holes) 6,894 → 10,034 cyc (209.0 µs) 930 → 1,448 cyc (30.2 µs) 6.93×. Unaffected by heap fragmentation.
Timer stop (T = 0 → 39) 515 → 1,370 cyc 450 → 1,050 cyc 1.30× at high timer load.
Timer restart (T = 0 → 39) 733 → 1,314 cyc 779 → 1,396 cyc Stock is 1.06× faster here. Same ~15–16 cycles per active timer slope.
Task msgSend (Q = 0 → 64) 497 → 935 cyc (+7 per message) 364 → 322 cyc (flat) 2.90× at Q=64. Strictly O(1) enqueue.
Task msgReceive (Q = 0 → 64) 383 → 628 cyc 168 → 333 cyc 2.28× at Q=0, 1.89× at Q=64.

Measured at 115,200 bps, from the last received byte’s interrupt to the start of the reply transmission. This is the path that decides how quickly Zigbee2MQTT or ZHA can pipeline commands.

Host serial operation Stock TI Z-Stack SMLIGHT ZeroStack Result
SYS_PING round trip 9,790 cyc 4,618 cyc 53% fewer total cycles
SYS_PING reply path after dispatch 4,921 cyc 816 cyc 83% fewer cycles
240-byte frame (maximum-length ZNP frame) 24,404 cyc 12,784 cyc 48% fewer cycles

O(1) lookup, allocation, and queueing keep security, NVRAM, and scheduling latency flat from 5 to 300 devices regardless of flash log age. ZeroStack produced byte-identical ciphertext, MICs, and frame counters in every security benchmark cell.

Next: Part 2: adversarial resilience.