Skip to content

Instantly share code, notes, and snippets.

-module(slow_tuples).
-export([
run/0
]).
run() ->
-module(func).
-export([go/4]).
%go(Child, Acc, Depth, Limit) ->
% {SeenAcc, LimitPosAcc, ChildAcc, BranchAcc} = Acc,
% case couch_key_tree:stem_tree(Depth + 1, Child, Limit, SeenAcc) of
% {NewSeenAcc, LimitPos, NewChild, NewBranches} ->
% NewLimitPosAcc = erlang:max(LimitPos, LimitPosAcc),
-module(func).
-export([go/4]).
go(Child, Acc, Depth, Limit) ->
{SeenAcc, LimitPosAcc, ChildAcc, BranchAcc} = Acc,
case couch_key_tree:stem_tree(Depth + 1, Child, Limit, SeenAcc) of
{NewSeenAcc, LimitPos, NewChild, NewBranches} ->
NewLimitPosAcc = erlang:max(LimitPos, LimitPosAcc),
--- func-no-opt.S 2022-03-21 15:42:16.000000000 -0500
+++ func-opt.S 2022-03-21 15:42:34.000000000 -0500
@@ -14,68 +14,60 @@
{label,2}.
{test,is_tuple,{f,6},[{x,1}]}.
{test,test_arity,{f,6},[{x,1},4]}.
- {get_tuple_element,{x,1},0,{x,4}}.
- {get_tuple_element,{x,1},1,{x,5}}.
- {get_tuple_element,{x,1},2,{x,6}}.
- {get_tuple_element,{x,1},3,{x,1}}.
--- couch_key_tree.no-sink-opt.S 2022-03-21 14:51:30.000000000 -0500
+++ couch_key_tree.opt.S 2022-03-21 14:50:44.000000000 -0500
@@ -26,7 +26,7 @@
{attributes, []}.
-{labels, 270}.
+{labels, 269}.
- {make_fun2,{f,229},0,0,1}.
- {'%',{var_info,{x,0},[{fun_type,{t_tuple,2,true,#{}}}]}}.
+ {make_fun2,{f,257},0,0,1}.
---
- {call,4,{f,148}}.
- {'%',{var_info,{x,0},[{type,{t_tuple,3,false,#{2 => number}}}]}}.
- {select_tuple_arity,{x,0},{f,146},{list,[3,{f,145},4,{f,144}]}}.
--- couch_key_tree.opt.S 2022-03-21 13:44:37.000000000 -0500
+++ couch_key_tree.no-opt.S 2022-03-21 13:44:58.000000000 -0500
@@ -26,7 +26,7 @@
{attributes, []}.
-{labels, 269}.
+{labels, 303}.
-module(slow_tuples).
-export([
run/0
]).
run() ->
Erlang/OTP 21 [erts-10.3.5.19] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]
Eshell V10.3.5.19 (abort with ^G)
1> couch_key_tree:gen_and_stem().
{2,617.2164916992188}
2> couch_key_tree_maps:gen_and_stem().
{0,514.348388671875}
--- couch_key_tree.21.S 2022-03-21 12:24:36.000000000 -0500
+++ couch_key_tree.23.S 2022-03-21 12:21:59.000000000 -0500
@@ -26,7 +26,7 @@
{attributes, []}.
-{labels, 303}.
+{labels, 269}.