You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding many child nodes to a node, better speed could be obtained by using a Capacity private property, to resize the internal children array few times instead of once per each added node.
Pros:
Speed when adding many many nodes
Cons:
The extra "Capacity" field adds 8 (or 16 in x64) bytes per node (more memory used) because an extra "Count" field should also be added, to remember the actual number of child nodes.
The text was updated successfully, but these errors were encountered:
This is implying that the internal number of children is limited to an nativeint so when compiled for 64bit, it can hold more since the limits of a nativeint are larger. Is it feasible to have that many children? Or can it be limited to a FixedUInt/LongWord and still maintain only 8 bytes per node regardless of target? This is an array of children, is 4,294,967,295 not enough for most cases? I would expect the system performance will suffer greatly with that many children (if even possible on 32bit).
If this does move forward, I would suggest a compiler define to determine the max number of child nodes allowed in the array rather than put a memory tax on every node that is not realistic. This way, if someone truly needs more than the 4 billion children on a node, they can recompile with that option on, but the rest of the users would not have to pay the penalty for compiling as 64bit. You already have the redefine for an integer, you could just wrap this around a compiler define and it would be seamless.
Continuing forward I would also suggest a Grow method which given a value of how many nodes to add to the array, would expand the array to allow for that number of new records. If I know in advance that I'm going to be adding a set number of items, this would further reduce the resizing that might otherwise get triggered every n records.
Deletions are also a problem, mass deleting records would potentially leave large gaps at the end of the array. A Pack option would resize the array back down to just what is really available.
An AutoPack public property could be exposed that when set to true would pack the opposite of Capacity.
When adding many child nodes to a node, better speed could be obtained by using a Capacity private property, to resize the internal children array few times instead of once per each added node.
Pros:
Speed when adding many many nodes
Cons:
The extra "Capacity" field adds 8 (or 16 in x64) bytes per node (more memory used) because an extra "Count" field should also be added, to remember the actual number of child nodes.
The text was updated successfully, but these errors were encountered: