Commit 3908980
Add NativeMap support
Summary:
This diff introduces `NativeMap`, a tagged representation of various `folly::F14FastMap` based specializations of `Value`.
In the `Protocol::Value` implementation, a map was always represented as `folly::F14FastMap<Value, Value>`, significantly increasing the memory use & reducing cache efficiency for anything other than the most complex types.
The set of specializations was chosen according to the most-commonly used set specializations as found in the meta codebase(s):
* `MapOf<primitive, primitive>`, for each primitive type, e.g. bool, i32, ..
* `MapOf<primitive, Object>`, for each primitive type, e.g. bool, i32, ..
* `MapOf<primitive, Value`, for each primitive type, e.g. bool, i32, ..
Lastly the fallback resolves to the default `Protocol::Value::map`, i.e. `MapOf<Value, Value>`, allowing any generic map structure at the highest relative cost.
Note: These specializations aren't set in stone & can be added/removed.
Reviewed By: thedavekwon
Differential Revision: D72358846
fbshipit-source-id: b018a3bed516906660d4467f13e1152be3c45b9e1 parent 6ff8254 commit 3908980
File tree
4 files changed
+564
-25
lines changed- third-party/thrift/src/thrift/lib/cpp2
- protocol
- test
4 files changed
+564
-25
lines changedLines changed: 45 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
119 | 164 | | |
120 | 165 | | |
121 | 166 | | |
| |||
0 commit comments