diff options
| author | bors <bors@rust-lang.org> | 2015-05-28 20:16:08 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-05-28 20:16:08 +0000 |
| commit | efebe45cc0f3265ee8bb6396952e93a2004128c8 (patch) | |
| tree | daee7feda139b3e58cf99f51b59cc4cb23f6958b /src/rustllvm/ExecutionEngineWrapper.cpp | |
| parent | 621a10e7f32d790c39a0b4528369cf7959dd7d34 (diff) | |
| parent | 5249cbb7fa31ea2e6e8d77b49bfda386215b1ce7 (diff) | |
| download | rust-efebe45cc0f3265ee8bb6396952e93a2004128c8.tar.gz rust-efebe45cc0f3265ee8bb6396952e93a2004128c8.zip | |
Auto merge of #25856 - bluss:binary-heap-hole, r=Gankro
collections: Make BinaryHeap panic safe in sift_up / sift_down Use a struct called Hole that keeps track of an invalid location in the vector and fills the hole on drop. I include a run-pass test that the current BinaryHeap fails, and the new one passes. NOTE: The BinaryHeap will still be inconsistent after a comparison fails. It will not have the heap property. What we fix is just that elements will be valid values. This is actually a performance win -- the new code does not bother to write in `zeroed()` values in the holes, it just leaves them as they were. Net result is something like a 5% decrease in runtime for `BinaryHeap::from_vec`. This can be further improved by using unchecked indexing (I confirmed it makes a difference, not a surprise with the non-sequential access going on), but let's leave that for another PR. Safety first :wink: Fixes #25842
Diffstat (limited to 'src/rustllvm/ExecutionEngineWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
