Skip to content

Commit 08cb7e8

Browse files
committed
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).
1 parent 4c708e4 commit 08cb7e8

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/couch/src/couch_btree.erl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
-include_lib("couch/include/couch_db.hrl").
2222

23+
-define(DEFAULT_CHUNK_SIZE, 1279).
24+
2325
% For the btree cache, the priority of the root node will be
2426
% this value. The priority is roughly how many cleanup interval
2527
% (second) they'll survive without any updates in the cache
@@ -463,12 +465,7 @@ chunkify([InElement | RestInList], ChunkThreshold, OutList, OutListSize, OutputC
463465

464466
-compile({inline, [get_chunk_size/0]}).
465467
get_chunk_size() ->
466-
try
467-
list_to_integer(config:get("couchdb", "btree_chunk_size", "1279"))
468-
catch
469-
error:badarg ->
470-
1279
471-
end.
468+
config:get_integer("couchdb", "btree_chunk_size", ?DEFAULT_CHUNK_SIZE).
472469

473470
modify_node(Bt, RootPointerInfo, Actions, QueryOutput, Depth0) ->
474471
Depth = Depth0 + 1,

0 commit comments

Comments
 (0)