This presentation is about the best practices of Java code optimization, optimization of multiple threads synchronization, optimization of garbage collection process and more.
This presentation by Andrii Antilikatorov (Lead Software Engineer, GlobalLogic) was delivered at GlobalLogic Java Conference in Krakow on December 12, 2015.
15. 15
Thread-safe variant of ArrayList
Manual synchronization of
operations with ArrayList
Use CopyOnWriteArrayList -
thread-safe variant of Array
List
16. 16
Synchronized or volatile variables?
Volatile variables are less expensive than synchronized
Volatile are thread-safe for atomic operations
Volatile acquires lock on variable, therefore not thread-safe
for non-atomic operations
17. 17
Additional memory-saving techniques
Make all your inner classes static by default
Prefer a BitSet to arrays/lists of Boolean
Use memory-efficient storages for tiny collections