This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch improve-btree-tests
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit bfff6c12c015b0e6e7fd711084c23d72edc51c5e
Author: Nick Vatamaniuc <[email protected]>
AuthorDate: Thu Aug 28 17:40:55 2025 -0400

    Use config:get_integer/3 in couch_btree
    
    Previously we used config:get/3 as that was probably before we had
    config:get_integer/3 implemented.
    
    The compile "inline" is also not adding much but left it in there for now.
    Benchmarking it, it save at most 10 nanoseconds at most per call when
    making 100M calls in a row (0.144744 usec vs 0.15082468 usec per call).
---
 src/couch/src/couch_btree.erl | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/couch/src/couch_btree.erl b/src/couch/src/couch_btree.erl
index f8c8ab675..b4e0e97fc 100644
--- a/src/couch/src/couch_btree.erl
+++ b/src/couch/src/couch_btree.erl
@@ -20,6 +20,8 @@
 
 -include_lib("couch/include/couch_db.hrl").
 
+-define(DEFAULT_CHUNK_SIZE, 1279).
+
 % For the btree cache, the priority of the root node will be
 % this value. The priority is roughly how many cleanup interval
 % (second) they'll survive without any updates in the cache
@@ -463,12 +465,7 @@ chunkify([InElement | RestInList], ChunkThreshold, 
OutList, OutListSize, OutputC
 
 -compile({inline, [get_chunk_size/0]}).
 get_chunk_size() ->
-    try
-        list_to_integer(config:get("couchdb", "btree_chunk_size", "1279"))
-    catch
-        error:badarg ->
-            1279
-    end.
+    config:get_integer("couchdb", "btree_chunk_size", ?DEFAULT_CHUNK_SIZE).
 
 modify_node(Bt, RootPointerInfo, Actions, QueryOutput, Depth0) ->
     Depth = Depth0 + 1,

Reply via email to