Issue
In DTO class I need to add getter and setter and to do this we have 2 option either use Lombok api to add all getter setter automatically or manually add all required methods. So In terms of performance which one is preferred ?
Solution
There are several ways performance is influenced by Lombok:
- There is overhead when building, releasing and deploying your application because (1) there is an additional Lombok library involved. This would mean more data to transfer and (2) when compiling your code, the machine has more to compile.
What the exact overhead would be? The latest .jar is only 1,9mb! In regard of compiling, it depends on how many times you are requesting a Lombok annotation and how many DTO's you have. Modern machines and developed applications can handle Lombok without issues.
- There is no overhead in running your application with Lombok because once the code is compiled, the exact principles stay the same for the code (constructors, getters/setters, etc.). There should only be performance issues when you have memory leaks in your code. There are several ways for analyzing memory leaks. However I don't see issues with memory leaks the way Lombok works.
Answered By - kenneth
Answer Checked By - Gilberto Lyons (JavaFixing Admin)