I am working with a pretty easy structure
[{
"id": 1,
"name": "Example",
"parent_id": null,
"order": 0,
"is_open": false,
"is_directory": true,
"meta": {
"revision": 0,
"created": 1456997356672,
"version": 0
},
"$loki": 1,
"children": []
}, {
"id": 5,
"name": "Double dip",
"parent_id": null,
"order": 0,
"is_open": false,
"is_directory": true,
"meta": {
"revision": 0,
"created": 1456997356672,
"version": 0
},
"$loki": 5,
"children": []
}]
However what I get back from Immutable.fromJS(...) is a List with two BitmapIndexedNode
I haven't found the direct cause, but the structure appears not to matter. It's when you have more than 8 items.
{
one: 1,
two: 2,
three: 3,
four: 4,
five: 5,
six: 6,
seven: 7,
eight: 8
}
=> ArrayMapNode
{
one: 1,
two: 2,
three: 3,
four: 4,
five: 5,
six: 6,
seven: 7,
eight: 8,
nine: 9
}
=> BitmapIndexedNode
It is 8 entries. This is a performance optimization where the each of these implementations have different performance characteristics for getting and setting, and ~8 entries is where BitmapIndexedNode begins to outperform ArrayMapNode.
Thanks @leebyron
Most helpful comment
It is 8 entries. This is a performance optimization where the each of these implementations have different performance characteristics for getting and setting, and ~8 entries is where BitmapIndexedNode begins to outperform ArrayMapNode.