GitHub user davisp opened a pull request:
https://github.com/apache/couchdb-couch/pull/71
Optimize couch_ejson_compare NIF
The old nif was allocating a set of collators that were reserved and
released by each scheduler thread. This coordination and the
accompanying mutex turned into a global point of contention when many
schedulers were using couch_ejson_compare.
This change removes the stack based concurrency control in favor of a
`__thread variable`. We end up with the same number of collators but
without any overhead around locking a central mutex.
This increases performance by roughly a factor of five.
COUCHDB-2732
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/cloudant/couchdb-couch
2732-optimize-couch-ejson-compare
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/couchdb-couch/pull/71.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #71
----
commit 6b38dfacbb97c5cb7c89a27115d1227c7c52dbba
Author: Paul J. Davis <[email protected]>
Date: 2015-07-13T17:14:09Z
Optimize couch_ejson_compare NIF
The old nif was allocating a set of collators that were reserved and
released by each scheduler thread. This coordination and the
accompanying mutex turned into a global point of contention when many
schedulers were using couch_ejson_compare.
This change removes the stack based concurrency control in favor of a
`__thread variable`. We end up with the same number of collators but
without any overhead around locking a central mutex.
This increases performance by roughly a factor of five.
COUCHDB-2732
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---