couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject couch commit: updated refs/heads/master to e19b262
Date Tue, 02 Jun 2015 22:59:04 GMT
Repository: couchdb-couch
Updated Branches:
  refs/heads/master 529339b6c -> e19b262d4


perf: http layer - speedup couchdb version lookup

It turned out that we spend a lot of our time for every request in the
function couch_server:get_version which simply gets the current CouchDB
version.

Instead of fetching a list of all loaded applications an filtering it
we are directly getting the current VSN of CouchDB.

Patched version is 10% faster for a simple /get on a document.

(Almost?) All our of request-handlers are accessing this function so it
should be beneficial for large areas of the http layer.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/e19b262d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/e19b262d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/e19b262d

Branch: refs/heads/master
Commit: e19b262d4e5bd5ff1765b22589b8d3eeaac88749
Parents: 529339b
Author: Robert Kowalski <rok@kowalski.gd>
Authored: Fri May 29 15:25:00 2015 +0200
Committer: Robert Kowalski <rok@kowalski.gd>
Committed: Wed Jun 3 00:57:58 2015 +0200

----------------------------------------------------------------------
 src/couch_server.erl | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/e19b262d/src/couch_server.erl
----------------------------------------------------------------------
diff --git a/src/couch_server.erl b/src/couch_server.erl
index 228edc3..77105ed 100644
--- a/src/couch_server.erl
+++ b/src/couch_server.erl
@@ -45,12 +45,9 @@ dev_start() ->
     couch:start().
 
 get_version() ->
-    Apps = application:loaded_applications(),
-    case lists:keysearch(couch, 1, Apps) of
-    {value, {_, _, Vsn}} ->
-        Vsn;
-    false ->
-        "0.0.0"
+    case application:get_key(couch, vsn) of
+        {ok, Version} -> Version;
+        undefined -> "0.0.0"
     end.
 get_version(short) ->
   %% strip git hash from version string


Mime
View raw message