diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-04-24 17:09:17 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-04-24 17:09:17 -0700 |
commit | 2fb94e3c4c4ade042fc1944f1bfa64609bff40b4 (patch) | |
tree | a3b649a53a0b634d3110daf2f8357d372a560841 /cpp/010vm | |
parent | 544a1f1e17d909673f08a50b97fc9d00df431eb4 (diff) | |
download | mu-2fb94e3c4c4ade042fc1944f1bfa64609bff40b4.tar.gz |
1166
Why did I think STL's map wasn't efficient? It has logarithmic complexity (maintains a tree internally) and is faster than hashing for small containers. It's the more portable solution and should be what I turn to by default.
Diffstat (limited to 'cpp/010vm')
-rw-r--r-- | cpp/010vm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cpp/010vm b/cpp/010vm index 76d41a71..48b68cdf 100644 --- a/cpp/010vm +++ b/cpp/010vm @@ -2,8 +2,8 @@ // A program is a book of 'recipes' (functions) typedef int recipe_number; :(before "End Globals") -unordered_map<string, recipe_number> Recipe_number; -unordered_map<recipe_number, recipe> Recipe; +map<string, recipe_number> Recipe_number; +map<recipe_number, recipe> Recipe; int Next_recipe_number = 1; :(before "End Types") @@ -56,7 +56,7 @@ struct property { :(before "End Globals") // Locations refer to a common 'memory'. Each location can store a number. -unordered_map<int, int> Memory; +map<int, int> Memory; :(before "End Setup") Memory.clear(); @@ -71,8 +71,8 @@ Memory.clear(); // seamless experience to help understand arbitrary mu programs. typedef int type_number; :(before "End Globals") -unordered_map<string, type_number> Type_number; -unordered_map<type_number, type_info> Type; +map<string, type_number> Type_number; +map<type_number, type_info> Type; int Next_type_number = 1; :(code) void setup_types() { |