inferred / FreeBuilder

Automatic generation of the Builder pattern for Java
Apache License 2.0
839 stars 101 forks source link

Evaluate optimizability of internal EnumSet #401

Open alicederyn opened 5 years ago

alicederyn commented 5 years ago

Allocating objects in hot loops can cause unwanted GC and memory pressure if the JVM cannot optimize them away with escape analysis. We use an EnumSet (to store which properties remain unset) versus bitwise operations for readability, but we could achieve similar readability by moving the bitwise logic into the generated Property enum, if there is any benefit.

alicederyn commented 5 years ago

This would have to be done with a microbenchmark library like https://github.com/alicep-org/benchmark