Producer-Consumer Linking at the Bytecode Level
summary
A dependency injection tool called Need modifies compiled bytecode to link producers and consumers directly instead of generating source, cutting build time by about 10%, reducing ANRs by ~400k/month, and shrinking APKs ~1 MB. It injects with property delegates, uses double‑checked locking for lazy singletons, supports multibindings, ViewModel injection, interface injection and flexible, composable component graphs, and handles parameterized providers. Limitations: Kotlin‑only, not JSR‑compatible, and bytecode transforms require dumps for debugging; repository is open source.
AI-written summary · about
chapters (21)
- 0:00Introduction
- 1:14Hilt challenges in TikTok
- 2:40Hilt component hierarchy limits
- 5:54Runtime issues and package size
- 7:20Ideal DI framework traits
- 8:24Need’s core principle
- 9:29Need’s bytecode linking
- 10:30Need basic example
- 13:18Parent component dependency
- 14:46Flexible component hierarchy
- 15:49Circular dependencies handling
- 16:11Interface injection in Need
- 17:15Need advanced features
- 19:51Performance after migration
- 20:34Need vs Hilt processing
- 22:03Runtime benefits of Need
- 23:28Need limitations and compatibility
- 25:54Why Need fits TikTok
- 26:14Future plans for Need
- 28:02Need is open source
- 28:30Q&A








