Open
Description
With the current implementation we have assert(3 <= list.length && list.length <= 12)
in src/0-core/concatenate/nodes.js
.
Plan:
- Write tests that cover all cases in
nodes
(fromlist.length = 3
tolist.length = 12
) 38b9e05 - Write a benchmark that stresses the
concat
method - Profile current implementation
- If any of
nodes
,_app3
,app3
shows up as a bottleneck, profile these implementations:- unroll loop iterations in
nodes
(max iterations is fixed) - switch on
list.length
innodes
7362602 - handle all cases separately as Digit methods and remove
nodes
: First implicit branch on the protototype ofB
, then implicit branch on the prototype ofA
(e.g.A._nodes_from_list_and_Two(list, B)
whereB instanceof Two
), and finally explicit branch onlist.length
using aswitch
- unroll loop iterations in
Also the current base cases in app3
use the generic _append
and _prepend
where list
has a size between 1 and 4.
- Explore unrolling these generic loops in those cases.