Performance Optimization Articles

Android Transformer Optimization: Attention and Mobile GPU Bottlenecks

A walkthrough of porting FlashAttention into an OpenGL ES Compute Shader on Android, using tiled computation and Online Softmax to cut attention memory traffic from O(n²) to O(n). Measured on the Mali-G710, latency dropped from 120ms to 18ms.

Android SurfaceView, TextureView, and SurfaceTexture: The Rendering Bridge from BufferQueue Producers to Surface Compositing

Starting from BufferQueue's producer-consumer model, this article breaks down the bridging relationships and compositing-path differences among SurfaceView, TextureView, and SurfaceTexture, and offers selection guidance for camera and video rendering.

Android On-Device Stable Diffusion: From Denoising Principles to LiteRT Mobile Image Generation

From Stable Diffusion denoising to LiteRT mobile deployment: FP16 quantization, LCM distillation, and on-demand loading cut single-image generation on Pixel 8 from 40 seconds to under 3 seconds.

Inside Android SQLite: Connection Pool Reuse, WAL Logging, and Transaction Isolation

A "database is locked" investigation leads into connection pool reuse, WAL logging, and transaction isolation internals, with a practical checklist for concurrent read/write scenarios.

Kotlin Lambdas, Function References, and Compose: Verify Before Caching

(Updated on )
Separate Kotlin callback semantics, JVM lowering, and Compose memoization; check Strong Skipping and prevent stale captured handlers before adding remember.

Android On-Device LLM Latency: From Tap to First Token

Break down and optimize the full Android on-device LLM path, from user input and model loading to prefill, decode, and first-token rendering.

Evaluating and Optimizing On-Device AI on Android: From Offline Benchmarks to Production Experiments

A from-scratch evaluation system for on-device AI: offline benchmarks for initial filtering, production confidence-distribution monitoring, and A/B experiments to drive decisions — cutting iteration cycles from 3 weeks to 1.5.

Phased Android Startup Initialization with background and activity StartTypes

Putting every initialization task into Application makes cold-start cost unpredictable. This article presents a phased startup framework that separates background and activity StartTypes with explicit dependencies, thread scheduling, fallback behavior, and timing metrics.

Async Inflate Manager: Thread-Pool Preloading for Faster First Frames

First-frame latency is not only about network and image loading. Complex XML layout inflation on the main thread can be expensive too. This article presents an async Inflate manager that pre-creates Views on a thread pool, uses MutableContextWrapper for context safety, and falls back to UI-thread inflation when needed.

Bytecode try-catch Instrumentation for Third-Party Crashes: Precise Containment with hookPoint

When a third-party SDK crash cannot be fixed in source code, bytecode try-catch instrumentation can be a practical containment tool. This article explains a hookPoint-driven design for precise method matching, non-fatal exception capture, reporting, and safety boundaries.

Compose Multiplatform Desktop in Practice: JVM Windows and Platform Interop

A practical migration from Electron to Compose Desktop, covering JVM window management, menu bars, drag and drop, system trays, platform interop, packaging, and distribution. Startup time improved by 60% and memory usage dropped by 70%.

A Unified Image Loading Facade with ImageUrlProcessor

If every page calls the image library directly, URL rules, size parameters, and preload logic scatter across the codebase. This article introduces a unified image-loading facade built around ImageUrlProcessor, preload scheduling, and observability.

Route Prefetching and Request Merging for Faster First-Screen Data

Page speed depends not only on API latency, but also on whether requests start early enough and whether duplicate calls are suppressed. This article combines PrefetchRouterInterceptor at the routing layer with MergeHolder at the network layer.

Android Simpleperf Flame Graphs: From CPU Sampling to Performance Bottleneck Analysis

A deep dive into Android Simpleperf, covering flame graph generation, call-stack analysis, cold-start hotspots, RenderThread investigation, multi-thread CPU attribution, and how to combine Simpleperf with Systrace.

What Are RecyclerView's Four Cache Levels? Understanding ViewHolder Reuse

A practical explanation of RecyclerView's four cache levels, ViewHolder reuse order, RecycledViewPool, Prefetch, and how they affect scrolling performance.

Android 16 KB Pages: Verify ELF and APK Alignment

(Updated on )
Make an Android native app work on 16 KB page-size devices: build the ELF correctly, package it correctly, and verify both artifacts.

Android Dynamic Feature Delivery: From App Bundle to SplitCompat

An end-to-end guide to Android dynamic feature delivery, covering App Bundle splits, SplitCompat runtime loading, Play Feature Delivery, and package size tradeoffs.

Android Audio System Deep Dive: AudioFlinger Mixing and AAudio Low Latency

A deep architecture walkthrough of the Android audio pipeline, from AudioTrack buffers and AudioFlinger mixer scheduling to AAudio MMAP pass-through, latency tradeoffs, and production API choices.

Android Perfetto End to End: ftrace, TrackEvent, and Production Monitoring

A deep dive into Android Perfetto, from the traced and traced_probes daemon architecture to kernel ftrace sources, shared ring buffers, SDK TrackEvent instrumentation, and production observability.

Designing an On-Device LLM Inference Scheduler: Priority Queues and Backpressure in Practice

This article shows how to build a scheduling layer above an on-device inference engine, using priority queues, preemption, and backpressure to avoid OOMs, unpredictable latency, and out-of-order results.