Two Dev.to articles describe performance bottlenecks in on-device Edge AI pipelines and propose architectural approaches to reduce latency and memory overhead. One article focuses on eliminating “abstraction tax” when running custom C++ operations from Kotlin. It argues that frequent JNI calls slow inference because each bridge crossing adds overhead such as context switching and argument marshalling. It recommends coarse-grained delegation: pass large buffers into native code and do bulk computation in C++. It also highlights zero-copy data transfer using off-heap DirectByteBuffers and GetDirectBufferAddress to avoid copying data between managed and native memory.

The second article focuses on image processing pipelines, arguing that the main bottleneck is often the “memory wall,” where copying frames between camera, CPU, GPU, and NPU causes heat, bandwidth pressure, and thermal throttling. It recommends zero-copy image handling with AHardwareBuffer and dmabuf so camera, GPU, and NPU can reference shared physical memory. It notes that transformations such as YUV to tensor formats may still be required, but can be performed in hardware (e.g., via GPU) while keeping data in shared buffers. Both articles emphasize correct native resource lifecycle management and careful alignment/coherency concerns when coordinating with NPUs and system services like AICore.