Commit 0ebbd76
committed
deps: V8: cherry-pick b49206d from upstream
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@{#52753}
PR-URL: #20727
Ref: #20083
Refs: #20083
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>1 parent 2773de5 commit 0ebbd76
4 files changed
+44
-68
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
136 | 137 | | |
137 | 138 | | |
138 | 139 | | |
139 | | - | |
140 | | - | |
141 | 140 | | |
142 | 141 | | |
143 | 142 | | |
| |||
148 | 147 | | |
149 | 148 | | |
150 | 149 | | |
151 | | - | |
152 | | - | |
| 150 | + | |
| 151 | + | |
153 | 152 | | |
154 | 153 | | |
155 | | - | |
| 154 | + | |
156 | 155 | | |
157 | | - | |
| 156 | + | |
158 | 157 | | |
159 | 158 | | |
160 | 159 | | |
| |||
165 | 164 | | |
166 | 165 | | |
167 | 166 | | |
168 | | - | |
169 | | - | |
170 | | - | |
| 167 | + | |
| 168 | + | |
171 | 169 | | |
172 | 170 | | |
173 | | - | |
| 171 | + | |
174 | 172 | | |
175 | 173 | | |
176 | 174 | | |
| |||
186 | 184 | | |
187 | 185 | | |
188 | 186 | | |
189 | | - | |
190 | | - | |
| 187 | + | |
| 188 | + | |
191 | 189 | | |
192 | 190 | | |
193 | 191 | | |
194 | 192 | | |
195 | 193 | | |
196 | 194 | | |
197 | | - | |
198 | | - | |
199 | 195 | | |
200 | 196 | | |
201 | 197 | | |
202 | 198 | | |
203 | 199 | | |
204 | 200 | | |
205 | | - | |
206 | 201 | | |
207 | 202 | | |
208 | 203 | | |
| |||
2240 | 2235 | | |
2241 | 2236 | | |
2242 | 2237 | | |
2243 | | - | |
| 2238 | + | |
2244 | 2239 | | |
2245 | | - | |
2246 | | - | |
2247 | | - | |
2248 | | - | |
2249 | | - | |
2250 | | - | |
| 2240 | + | |
2251 | 2241 | | |
2252 | 2242 | | |
2253 | 2243 | | |
| |||
2294 | 2284 | | |
2295 | 2285 | | |
2296 | 2286 | | |
2297 | | - | |
2298 | | - | |
2299 | | - | |
2300 | | - | |
2301 | | - | |
2302 | | - | |
2303 | | - | |
2304 | | - | |
2305 | | - | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
2306 | 2292 | | |
2307 | 2293 | | |
2308 | 2294 | | |
2309 | 2295 | | |
2310 | | - | |
2311 | | - | |
2312 | | - | |
| 2296 | + | |
| 2297 | + | |
2313 | 2298 | | |
2314 | 2299 | | |
2315 | 2300 | | |
2316 | 2301 | | |
2317 | | - | |
2318 | | - | |
2319 | | - | |
| 2302 | + | |
2320 | 2303 | | |
2321 | 2304 | | |
2322 | 2305 | | |
2323 | | - | |
2324 | | - | |
2325 | | - | |
2326 | | - | |
2327 | | - | |
2328 | | - | |
2329 | | - | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
2330 | 2309 | | |
| 2310 | + | |
2331 | 2311 | | |
2332 | 2312 | | |
2333 | 2313 | | |
| |||
2502 | 2482 | | |
2503 | 2483 | | |
2504 | 2484 | | |
2505 | | - | |
2506 | | - | |
2507 | | - | |
2508 | | - | |
2509 | 2485 | | |
2510 | 2486 | | |
2511 | 2487 | | |
| |||
2563 | 2539 | | |
2564 | 2540 | | |
2565 | 2541 | | |
2566 | | - | |
2567 | | - | |
| 2542 | + | |
| 2543 | + | |
2568 | 2544 | | |
2569 | 2545 | | |
2570 | 2546 | | |
| |||
2578 | 2554 | | |
2579 | 2555 | | |
2580 | 2556 | | |
2581 | | - | |
2582 | | - | |
2583 | | - | |
2584 | | - | |
2585 | | - | |
2586 | | - | |
2587 | 2557 | | |
2588 | 2558 | | |
2589 | 2559 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
247 | 248 | | |
248 | 249 | | |
249 | 250 | | |
| 251 | + | |
| 252 | + | |
250 | 253 | | |
251 | 254 | | |
252 | 255 | | |
| |||
287 | 290 | | |
288 | 291 | | |
289 | 292 | | |
290 | | - | |
291 | 293 | | |
292 | 294 | | |
293 | 295 | | |
| |||
550 | 552 | | |
551 | 553 | | |
552 | 554 | | |
553 | | - | |
554 | | - | |
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
| |||
1371 | 1371 | | |
1372 | 1372 | | |
1373 | 1373 | | |
1374 | | - | |
1375 | | - | |
1376 | 1374 | | |
1377 | 1375 | | |
1378 | 1376 | | |
1379 | 1377 | | |
1380 | 1378 | | |
1381 | | - | |
| 1379 | + | |
1382 | 1380 | | |
1383 | 1381 | | |
1384 | | - | |
| 1382 | + | |
1385 | 1383 | | |
1386 | 1384 | | |
1387 | | - | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
1388 | 1392 | | |
1389 | 1393 | | |
1390 | 1394 | | |
| |||
1412 | 1416 | | |
1413 | 1417 | | |
1414 | 1418 | | |
1415 | | - | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
1416 | 1423 | | |
1417 | 1424 | | |
1418 | 1425 | | |
1419 | 1426 | | |
1420 | | - | |
| 1427 | + | |
1421 | 1428 | | |
1422 | 1429 | | |
1423 | 1430 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | 52 | | |
54 | 53 | | |
55 | 54 | | |
| |||
0 commit comments