Cache DecimalFormatSymbols instances to reduce lock contention #1414

Merged
merged 1 commit into from Jan 17, 2014

Conversation

Projects
None yet
3 participants
@bbrowning
Contributor

bbrowning commented Jan 17, 2014

Constructing new DecimalFormatSymbols instances requires locking, and
in some sample Rails apps this contention was bubbling up as a
bottleneck. So, this change caches DecimalFormatSymbols 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.

Cache DecimalFormatSymbol instances to reduce lock contention
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.

headius added a commit that referenced this pull request Jan 17, 2014

Merge pull request #1414 from bbrowning/decimalformatcache
Cache DecimalFormatSymbols instances to reduce lock contention

@headius headius merged commit 716ebbc into jruby:jruby-1_7 Jan 17, 2014

1 check failed

default The Travis CI build failed
Details

@enebo enebo added this to the JRuby 1.7.11 milestone Feb 21, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment