Commit 646445b
committed
deps: V8: backport b49206d from upstream
This is the v8.x backport of nodejs#20727.
Original commit message:
ThreadDataTable: Change global linked list to per-Isolate hash map.
For use cases with a large number of threads or a large number of
isolates (or both), ThreadDataTable can be a major performance
bottleneck due to O(n) lookup time of the linked list. Switching to a
hash map reduces this to O(1).
Example 1: Sandstorm.io, a Node.js app that utilizes "fibers", was
observed spending the majority of CPU time iterating over the
ThreadDataTable.
See: https://sandstorm.io/news/2016-09-30-fiber-bomb-debugging-story
Example 2: Cloudflare's Workers engine, a high-multi-tenancy web
server framework built on V8 (but not Node), creates large numbers of
threads and isolates per-process. It saw a 34x improvement in
throughput when we applied this patch.
Cloudflare has been using a patch in production since the Worker
launch which replaces the linked list with a hash map -- but still
global.
This commit builds on that but goes further and creates a separate
hash map and mutex for each isolate, with the table being a member of
the Isolate class. This avoids any globals and should reduce lock
contention.
Bug: v8:5338
Change-Id: If0d11509afb2e043b888c376e36d3463db931b47
Reviewed-on: https://chromium-review.googlesource.com/1014407
Reviewed-by: Yang Guo <[email protected]>
Commit-Queue: Yang Guo <[email protected]>
Cr-Commit-Position: refs/heads/master@{nodejs#52753}
Backport-PR-URL: nodejs#21529
PR-URL: nodejs#20727
Refs: nodejs#20083
Refs: nodejs#20083
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>1 parent 978e1b1 commit 646445b
4 files changed
+45
-71
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
131 | | - | |
132 | | - | |
133 | 132 | | |
134 | 133 | | |
135 | 134 | | |
| |||
140 | 139 | | |
141 | 140 | | |
142 | 141 | | |
143 | | - | |
144 | | - | |
| 142 | + | |
| 143 | + | |
145 | 144 | | |
146 | 145 | | |
147 | | - | |
| 146 | + | |
148 | 147 | | |
149 | | - | |
| 148 | + | |
150 | 149 | | |
151 | 150 | | |
152 | 151 | | |
| |||
157 | 156 | | |
158 | 157 | | |
159 | 158 | | |
160 | | - | |
161 | | - | |
162 | | - | |
| 159 | + | |
| 160 | + | |
163 | 161 | | |
164 | 162 | | |
165 | | - | |
| 163 | + | |
166 | 164 | | |
167 | 165 | | |
168 | 166 | | |
| |||
178 | 176 | | |
179 | 177 | | |
180 | 178 | | |
181 | | - | |
182 | | - | |
| 179 | + | |
| 180 | + | |
183 | 181 | | |
184 | 182 | | |
185 | 183 | | |
186 | 184 | | |
187 | 185 | | |
188 | 186 | | |
189 | | - | |
190 | | - | |
191 | 187 | | |
192 | 188 | | |
193 | 189 | | |
194 | 190 | | |
195 | 191 | | |
196 | 192 | | |
197 | | - | |
198 | 193 | | |
199 | 194 | | |
200 | 195 | | |
| |||
2093 | 2088 | | |
2094 | 2089 | | |
2095 | 2090 | | |
| 2091 | + | |
2096 | 2092 | | |
2097 | | - | |
2098 | | - | |
2099 | | - | |
2100 | | - | |
2101 | | - | |
2102 | | - | |
2103 | | - | |
2104 | | - | |
2105 | | - | |
2106 | | - | |
2107 | | - | |
| 2093 | + | |
2108 | 2094 | | |
2109 | 2095 | | |
2110 | 2096 | | |
| |||
2151 | 2137 | | |
2152 | 2138 | | |
2153 | 2139 | | |
2154 | | - | |
2155 | | - | |
2156 | | - | |
2157 | | - | |
2158 | | - | |
2159 | | - | |
2160 | | - | |
2161 | | - | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
2162 | 2145 | | |
2163 | 2146 | | |
2164 | 2147 | | |
2165 | 2148 | | |
2166 | | - | |
2167 | | - | |
2168 | | - | |
| 2149 | + | |
| 2150 | + | |
2169 | 2151 | | |
2170 | 2152 | | |
2171 | 2153 | | |
2172 | 2154 | | |
2173 | | - | |
2174 | | - | |
2175 | | - | |
| 2155 | + | |
2176 | 2156 | | |
2177 | 2157 | | |
2178 | 2158 | | |
2179 | | - | |
2180 | | - | |
2181 | | - | |
2182 | | - | |
2183 | | - | |
2184 | | - | |
2185 | | - | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
2186 | 2162 | | |
| 2163 | + | |
2187 | 2164 | | |
2188 | 2165 | | |
2189 | 2166 | | |
| |||
2360 | 2337 | | |
2361 | 2338 | | |
2362 | 2339 | | |
2363 | | - | |
2364 | | - | |
2365 | | - | |
2366 | | - | |
2367 | 2340 | | |
2368 | 2341 | | |
2369 | 2342 | | |
| |||
2418 | 2391 | | |
2419 | 2392 | | |
2420 | 2393 | | |
2421 | | - | |
2422 | | - | |
| 2394 | + | |
| 2395 | + | |
2423 | 2396 | | |
2424 | 2397 | | |
2425 | 2398 | | |
| |||
2429 | 2402 | | |
2430 | 2403 | | |
2431 | 2404 | | |
2432 | | - | |
2433 | | - | |
2434 | | - | |
2435 | | - | |
2436 | | - | |
2437 | | - | |
2438 | 2405 | | |
2439 | 2406 | | |
2440 | 2407 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
243 | 245 | | |
244 | 246 | | |
245 | 247 | | |
| 248 | + | |
| 249 | + | |
246 | 250 | | |
247 | 251 | | |
248 | 252 | | |
| |||
283 | 287 | | |
284 | 288 | | |
285 | 289 | | |
286 | | - | |
287 | 290 | | |
288 | 291 | | |
289 | 292 | | |
| |||
557 | 560 | | |
558 | 561 | | |
559 | 562 | | |
560 | | - | |
561 | | - | |
562 | 563 | | |
563 | 564 | | |
564 | 565 | | |
| |||
1334 | 1335 | | |
1335 | 1336 | | |
1336 | 1337 | | |
1337 | | - | |
1338 | | - | |
1339 | 1338 | | |
1340 | 1339 | | |
1341 | 1340 | | |
1342 | 1341 | | |
1343 | 1342 | | |
1344 | | - | |
| 1343 | + | |
1345 | 1344 | | |
1346 | 1345 | | |
1347 | | - | |
| 1346 | + | |
1348 | 1347 | | |
1349 | 1348 | | |
1350 | | - | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
1351 | 1356 | | |
1352 | 1357 | | |
1353 | 1358 | | |
| |||
1375 | 1380 | | |
1376 | 1381 | | |
1377 | 1382 | | |
1378 | | - | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
1379 | 1387 | | |
1380 | 1388 | | |
1381 | 1389 | | |
1382 | 1390 | | |
1383 | | - | |
| 1391 | + | |
1384 | 1392 | | |
1385 | 1393 | | |
1386 | 1394 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | 49 | | |
51 | 50 | | |
52 | 51 | | |
| |||
0 commit comments