Skip to content

Instantly share code, notes, and snippets.

@apage43
Created December 12, 2011 18:58
Show Gist options
  • Save apage43/1468578 to your computer and use it in GitHub Desktop.
Save apage43/1468578 to your computer and use it in GitHub Desktop.
f(Vals), f(Mals).
Vals = [{insert, iolist_to_binary([<<"test">>, io_lib:format("~6..0B", [X])]), {X, {X, <<1>>}, 0, 0, 5}} || X <- lists:seq(1,20000)].
Mals = [{insert, iolist_to_binary([<<"test">>, io_lib:format("~6..0B", [X*2])]), {X, {X, <<1>>}, 0, 0, 10}} || X <- lists:seq(1,20000)].
f(D), f(F), f(B).
couch_server:delete(<<"testdb">>, []).
rr(couch_db).
{ok,#db{docinfo_by_id_btree = B, fd = F} = D} = couch_server:create(<<"testdb">>, []).
f(NB), f(ND).
{ok, _, NB} = btree_nif:query_modify_raw_native(D, B, Vals).
ND = D#db{docinfo_by_id_btree = NB}.
f(Nt), f(Et).
{Nt, _} = timer:tc(btree_nif, query_modify_raw_native, [ND, NB, Mals]).
{Et, _} = timer:tc(couch_btree, query_modify_raw, [NB, Mals]).
Et/Nt.
io:format("~p~n", [couch_file:pread_term(F,
test inserting records to by_seq btree at erlang shell (./couchdb -i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment