[llvm-commits] [llvm] r120232 - /llvm/trunk/include/llvm/ADT/IntervalMap.h
Jakob Stoklund Olesen
stoklund at 2pi.dk
Sat Nov 27 22:14:33 PST 2010
Author: stoklund
Date: Sun Nov 28 00:14:33 2010
New Revision: 120232
URL: http://llvm.org/viewvc/llvm-project?rev=120232&view=rev
Log:
Speed up simple insertions into an unbranched tree by not creating an iterator.
Modified:
llvm/trunk/include/llvm/ADT/IntervalMap.h
Modified: llvm/trunk/include/llvm/ADT/IntervalMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/IntervalMap.h?rev=120232&r1=120231&r2=120232&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/IntervalMap.h (original)
+++ llvm/trunk/include/llvm/ADT/IntervalMap.h Sun Nov 28 00:14:33 2010
@@ -1128,7 +1128,12 @@
/// It is assumed that no key in the interval is mapped to another value, but
/// overlapping intervals already mapped to y will be coalesced.
void insert(KeyT a, KeyT b, ValT y) {
- find(a).insert(a, b, y);
+ if (branched() || rootSize == RootLeaf::Capacity)
+ return find(a).insert(a, b, y);
+
+ // Easy insert into root leaf.
+ unsigned p = rootLeaf().findFrom(0, rootSize, a);
+ rootSize = rootLeaf().insertFrom(p, rootSize, a, b, y).second;
}
/// clear - Remove all entries.
More information about the llvm-commits
mailing list