Slashing Lead Times by 30%: The Impact of Using Explicit Types in JVM
Article Summary
alexxozo from Glovo's engineering team discovered that a single line of code change slashed their build time by 30%. The culprit? Java's type inference struggling with large Map definitions.
Glovo's feed service team faced a critical bottleneck: 35-minute builds were killing their ability to experiment and respond to incidents quickly. After migrating from Jenkins to GitHub Actions and optimizing tests, compilation time remained painfully slow. The breakthrough came from diving deep into Gradle's verbose logging.
Key Takeaways
- Build time dropped 30% by adding explicit types to Map.ofEntries calls
- Gradle's options.verbose flag revealed one class taking 5+ minutes to compile
- JVM type inference breaks down with 500+ Map entries in single declaration
- Parallel builds and incremental compilation cut memory usage significantly
- Lead time reduction enables faster product experimentation and incident response
Critical Insight
Adding Map.<String, String>ofEntries instead of Map.ofEntries reduced compilation from 35 to 25 minutes by eliminating expensive type inference on large static data structures.