Commit 4b5410b
authored
perf: Send engine callback before tracker bookkeeping and add tracing spans (#11970)
## Summary
Moves the engine callback send in task `execute()` to fire immediately
after output is flushed (`output_client.finish()`), before the tracker
bookkeeping (`tracker.cached()`, `tracker.build_succeeded()`, etc.).
This unblocks the engine's DAG walker sooner — dependent tasks can be
dispatched while the completed task's run summary tracking happens in
the background.
| Repo | Tasks | Baseline | After | Delta |
|------|-------|----------|-------|-------|
| Small (~5 packages) | 5 | 164ms | 163ms | ~flat |
| Medium (~125 packages) | 70 | 848ms | 864ms | ~flat |
| Large (~1000 packages) | 1700 | 845ms | 804ms | **-41ms (-4.9%)** |
Profiled with `--profile` across three monorepos of varying size (full
cache hit scenario, median of 5 warm runs).
## Changes
Also adds tracing spans throughout the dispatch loop and builder startup
for profiling visibility:
- `visit_recv_wait`, `task_cache_new`, `exec_context_new` in the
dispatch loop
- `micro_frontends_from_disk`, `task_access_setup`,
`turbo_json_loader_setup`, `root_turbo_json_load`,
`pkg_dep_graph_validate` in builder startup
Output ordering is preserved because the callback fires after all log
replay and output flushing is complete.
- **`crates/turborepo-task-executor/src/exec.rs`** — Restructured
`execute()` to send callback immediately after output flush, before
tracker bookkeeping.
- **`crates/turborepo-lib/src/task_graph/visitor/mod.rs`** — Added
`visit_recv_wait`, `task_cache_new`, `exec_context_new` tracing spans.
- **`crates/turborepo-lib/src/run/builder.rs`** — Added tracing spans
for uninstrumented startup phases.1 parent 75406f6 commit 4b5410b
File tree
3 files changed
+106
-68
lines changed- crates
- turborepo-lib/src
- run
- task_graph/visitor
- turborepo-task-executor/src
3 files changed
+106
-68
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
263 | | - | |
| 263 | + | |
| 264 | + | |
264 | 265 | | |
265 | 266 | | |
266 | 267 | | |
267 | 268 | | |
268 | 269 | | |
269 | | - | |
| 270 | + | |
| 271 | + | |
270 | 272 | | |
271 | 273 | | |
272 | 274 | | |
| |||
323 | 325 | | |
324 | 326 | | |
325 | 327 | | |
326 | | - | |
327 | | - | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
328 | 334 | | |
329 | 335 | | |
330 | 336 | | |
331 | 337 | | |
332 | 338 | | |
333 | 339 | | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
368 | 377 | | |
369 | 378 | | |
370 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
371 | 383 | | |
372 | | - | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
373 | 388 | | |
374 | 389 | | |
375 | 390 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | | - | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
340 | 347 | | |
341 | 348 | | |
342 | 349 | | |
| |||
382 | 389 | | |
383 | 390 | | |
384 | 391 | | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
391 | 397 | | |
392 | 398 | | |
393 | 399 | | |
| |||
405 | 411 | | |
406 | 412 | | |
407 | 413 | | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
417 | 426 | | |
418 | 427 | | |
419 | 428 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
296 | 295 | | |
297 | 296 | | |
298 | | - | |
299 | | - | |
| 297 | + | |
300 | 298 | | |
301 | 299 | | |
302 | 300 | | |
303 | 301 | | |
304 | 302 | | |
305 | 303 | | |
306 | 304 | | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
307 | 313 | | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
308 | 325 | | |
309 | 326 | | |
310 | 327 | | |
311 | 328 | | |
312 | 329 | | |
313 | 330 | | |
314 | 331 | | |
315 | | - | |
316 | 332 | | |
317 | 333 | | |
318 | 334 | | |
319 | 335 | | |
320 | | - | |
321 | 336 | | |
322 | 337 | | |
323 | 338 | | |
324 | | - | |
325 | 339 | | |
326 | 340 | | |
327 | 341 | | |
| |||
0 commit comments