mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Implement a trie data structure. Specifically, implement
a ternary tree with a fixed-length per-node inline key buffer. I plan to use this for metadata path caches, where it's useful to be able to quickly find the most-derived point along a path that you've already cached, but it should be useful for other things in the compiler as well, like function-with-argument-label lookups and possibly code completion. This is quite a bit more space-efficient (and somewhat faster) than doing scans after a lower_bound on a std::map<std::string, T>. I haven't implemented balancing yet, and I don't need delete at all for metadata paths, so I don't plan to work on that. Swift SVN r32453
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
|
||||
using namespace swift;
|
||||
|
||||
namespace {
|
||||
|
||||
struct Element {
|
||||
unsigned X, Y, Z;
|
||||
|
||||
@@ -100,6 +102,8 @@ struct Tester {
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
TEST(EncodedSequenceTest, PushIterate) {
|
||||
Tester tester;
|
||||
tester.check();
|
||||
|
||||
Reference in New Issue
Block a user