]> Cypherpunks repositories - gostls13.git/commit
runtime: add iterator abstraction for mTreap
authorMichael Anthony Knyszek <mknyszek@google.com>
Mon, 26 Nov 2018 23:56:35 +0000 (23:56 +0000)
committerMichael Knyszek <mknyszek@google.com>
Mon, 17 Dec 2018 23:28:18 +0000 (23:28 +0000)
commit3651476075bad3d21d4dbaddc9a7d298d3d97e24
tree6076f3db9e93c415c191750def5d366e1f889672
parent9a3c1a1bc8ec81925925d6699577ff7812be3d58
runtime: add iterator abstraction for mTreap

This change adds the treapIter type which provides an iterator
abstraction for walking over an mTreap. In particular, the mTreap type
now has iter() and rev() for iterating both forwards (smallest to
largest) and backwards (largest to smallest). It also has an erase()
method for erasing elements at the iterator's current position.

For #28479.

While the expectation is that this change will slow down Go programs,
the impact on Go1 and Garbage is negligible.

Go1:     https://perf.golang.org/search?q=upload:20181214.6
Garbage: https://perf.golang.org/search?q=upload:20181214.11

Change-Id: I60dbebbbe73cbbe7b78d45d2093cec12cc0bc649
Reviewed-on: https://go-review.googlesource.com/c/151537
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/export_test.go
src/runtime/mgclarge.go
src/runtime/mheap.go