Cache DecimalFormatSymbols instances to reduce lock contention #1414
Constructing new DecimalFormatSymbols instances requires locking, and
The overall throughput in my test application wasn't much changed
Constructing new DecimalFormatSymbol instances requires locking, and in some sample Rails apps this contention was bubbling up as a bottleneck. So, this change caches DecimalFormatSymbol instances per-thread just like NumberFormat instances are already cached. The overall throughput in my test application wasn't much changed because of ActiveRecord's connection mutex still sitting in this way, but this does get rid of one source of multi-threaded lock contention.