Java/Angular Build Speed Improvements
Dylan Watson
Posted on September 7, 2020
I've been inspired to fix our build times after watching:
I'll be updating this as I investigate different techniques this week.
Here are a list of improvements and the effect they had on build times.
Java & Spring Boot
Spring lazy init
spring.main.lazy-initialization=true
This made the build twice as slow.. and broke the swagger tests as some of the endpoints didn't get instantiated.
Logging
Reduce all logging to only log on WARN
logging.level.root=WARN
Have a single "test" profile
The more profiles you have in tests, the more the spring DI ApplicationContext cache has to be reset. This can have a massive speed impact on your tests.
Test Slices
https://www.baeldung.com/spring-tests#5-using-test-slices
Turn integration tests into unit tests
This one requires considering that integration tests or "SpringBootTests" are really just testing that spring is configured correctly.
Most of the logic should be in fast unit tests.
Have maybe a single integration test
Typescript/Angular/Jest
Switch to Jest
Use @swc-node/jest
https://github.com/Brooooooklyn/swc-node
Use babel for jest
Posted on September 7, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.