Commit 8b544f3
authored
[lldb] Do not use LC_FUNCTION_STARTS data to determine symbol size as symbols are created (#155282)
Note: This is a resubmission of #106791. I had to revert this a year ago
for a failing test that I could not understand. I have time now to try
and get this in again.
Summary:
This improves the performance of ObjectFileMacho::ParseSymtab by
removing eager and expensive work in favor of doing it later in a
less-expensive fashion.
Experiment:
My goal was to understand LLDB's startup time.
First, I produced a Debug build of LLDB (no dSYM) and a
Release+NoAsserts build of LLDB. The Release build debugged the Debug
build as it debugged a small C++ program. I found that
ObjectFileMachO::ParseSymtab accounted for somewhere between 1.2 and 1.3
seconds consistently. After applying this change, I consistently
measured a reduction of approximately 100ms, putting the time closer to
1.1s and 1.2s on average.
Background:
ObjectFileMachO::ParseSymtab will incrementally create symbols by
parsing nlist entries from the symtab section of a MachO binary. As it
does this, it eagerly tries to determine the size of symbols (e.g. how
long a function is) using LC_FUNCTION_STARTS data (or eh_frame if
LC_FUNCTION_STARTS is unavailable). Concretely, this is done by
performing a binary search on the function starts array and calculating
the distance to the next function or the end of the section (whichever
is smaller).
However, this work is unnecessary for 2 reasons:
1. If you have debug symbol entries (i.e. STABs), the size of a function
is usually stored right after the function's entry. Performing this work
right before parsing the next entry is unnecessary work.
2. Calculating symbol sizes for symbols of size 0 is already performed
in `Symtab::InitAddressIndexes` after all the symbols are added to the
Symtab. It also does this more efficiently by walking over a list of
symbols sorted by address, so the work to calculate the size per symbol
is constant instead of O(log n).1 parent 511210d commit 8b544f3
1 file changed
+0
-122
lines changedLines changed: 0 additions & 122 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2785 | 2785 | | |
2786 | 2786 | | |
2787 | 2787 | | |
2788 | | - | |
2789 | 2788 | | |
2790 | 2789 | | |
2791 | 2790 | | |
| |||
3437 | 3436 | | |
3438 | 3437 | | |
3439 | 3438 | | |
3440 | | - | |
3441 | | - | |
3442 | | - | |
3443 | | - | |
3444 | | - | |
3445 | | - | |
3446 | | - | |
3447 | | - | |
3448 | | - | |
3449 | | - | |
3450 | | - | |
3451 | | - | |
3452 | | - | |
3453 | | - | |
3454 | | - | |
3455 | | - | |
3456 | | - | |
3457 | | - | |
3458 | | - | |
3459 | | - | |
3460 | | - | |
3461 | | - | |
3462 | | - | |
3463 | | - | |
3464 | | - | |
3465 | | - | |
3466 | | - | |
3467 | | - | |
3468 | | - | |
3469 | | - | |
3470 | | - | |
3471 | | - | |
3472 | | - | |
3473 | | - | |
3474 | | - | |
3475 | | - | |
3476 | | - | |
3477 | | - | |
3478 | | - | |
3479 | | - | |
3480 | | - | |
3481 | | - | |
3482 | | - | |
3483 | | - | |
3484 | | - | |
3485 | | - | |
3486 | | - | |
3487 | | - | |
3488 | | - | |
3489 | | - | |
3490 | | - | |
3491 | | - | |
3492 | | - | |
3493 | | - | |
3494 | | - | |
3495 | 3439 | | |
3496 | 3440 | | |
3497 | 3441 | | |
| |||
3620 | 3564 | | |
3621 | 3565 | | |
3622 | 3566 | | |
3623 | | - | |
3624 | | - | |
3625 | | - | |
3626 | 3567 | | |
3627 | 3568 | | |
3628 | 3569 | | |
| |||
3711 | 3652 | | |
3712 | 3653 | | |
3713 | 3654 | | |
3714 | | - | |
3715 | 3655 | | |
3716 | 3656 | | |
3717 | 3657 | | |
| |||
4297 | 4237 | | |
4298 | 4238 | | |
4299 | 4239 | | |
4300 | | - | |
4301 | | - | |
4302 | | - | |
4303 | | - | |
4304 | | - | |
4305 | | - | |
4306 | | - | |
4307 | | - | |
4308 | | - | |
4309 | | - | |
4310 | | - | |
4311 | | - | |
4312 | | - | |
4313 | | - | |
4314 | | - | |
4315 | | - | |
4316 | | - | |
4317 | | - | |
4318 | | - | |
4319 | | - | |
4320 | | - | |
4321 | | - | |
4322 | | - | |
4323 | | - | |
4324 | | - | |
4325 | | - | |
4326 | | - | |
4327 | | - | |
4328 | | - | |
4329 | | - | |
4330 | | - | |
4331 | | - | |
4332 | | - | |
4333 | | - | |
4334 | | - | |
4335 | | - | |
4336 | | - | |
4337 | | - | |
4338 | | - | |
4339 | | - | |
4340 | | - | |
4341 | 4240 | | |
4342 | 4241 | | |
4343 | 4242 | | |
| |||
4444 | 4343 | | |
4445 | 4344 | | |
4446 | 4345 | | |
4447 | | - | |
4448 | | - | |
4449 | | - | |
4450 | 4346 | | |
4451 | 4347 | | |
4452 | 4348 | | |
| |||
4565 | 4461 | | |
4566 | 4462 | | |
4567 | 4463 | | |
4568 | | - | |
4569 | 4464 | | |
4570 | | - | |
4571 | | - | |
4572 | | - | |
4573 | | - | |
4574 | | - | |
4575 | | - | |
4576 | | - | |
4577 | | - | |
4578 | | - | |
4579 | | - | |
4580 | | - | |
4581 | | - | |
4582 | | - | |
4583 | | - | |
4584 | | - | |
4585 | 4465 | | |
4586 | 4466 | | |
4587 | 4467 | | |
| |||
4593 | 4473 | | |
4594 | 4474 | | |
4595 | 4475 | | |
4596 | | - | |
4597 | | - | |
4598 | 4476 | | |
4599 | 4477 | | |
4600 | 4478 | | |
| |||
0 commit comments