Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Free up a slot in the Node class by removing the "last" property. Thi…
…s is done by making the "previous" node list circular, so that "first.previous" returns the same value as "last". Here the "next" list is left as a simple list terminating with a null. Originally, I attempted to use also make this circular (as the symmetry with the previous list was appealing). However, this change "getNext" from a simple property retrieval to a conditional and this function is hot enough that it caused a compile time performance regression. In this version "getNext" remains unchanged and no performance impact was measurable. This has the following coding implications: - in the Node class "previous" and "getPrevious()" no longer produce the same value - it is no longer possible to call "getPrevious" on a detached Node as the "first" child of the parent must be known. - removeChildren() returns a circular list - "Children" and "Child" methods can no longer be used interchangeably for a single detached Node - it is no longer possible to add a "tail" portion of a detached list This change has the following benefits: - the correct Child/Children methods must be called for the node structure ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=129346032
- Loading branch information