Aside from the thread-safety issue (which in Xstream is circumvented via the use of thread-locals), SimpleDateFormat causes the JDK to initialize all possible timezones, resulting in a heap overhead of about 3.5MB (measured on x86_64).
It would be better to use DateTimeFormatter and avoiding the use of the z pattern (which also triggers the initialization of the timezones).
Aside from the thread-safety issue (which in Xstream is circumvented via the use of thread-locals),
SimpleDateFormat
causes the JDK to initialize all possible timezones, resulting in a heap overhead of about 3.5MB (measured on x86_64). It would be better to useDateTimeFormatter
and avoiding the use of thez
pattern (which also triggers the initialization of the timezones).triggers the time-zone initialization, while
does not. The following table summarizes the heap impact: