Commit ba668eb
authored
Re-apply [lldb] Do not use LC_FUNCTION_STARTS data to determine symbol size as symbols are created (llvm#117079)
I backed this out due to a problem on one of the bots that myself and
others have problems reproducing locally. I'd like to try to land it
again, at least to gain more information.
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 fd2e048 commit ba668eb
1 file changed
+0
-63
lines changedLines changed: 0 additions & 63 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3768 | 3768 | | |
3769 | 3769 | | |
3770 | 3770 | | |
3771 | | - | |
3772 | 3771 | | |
3773 | 3772 | | |
3774 | 3773 | | |
| |||
4354 | 4353 | | |
4355 | 4354 | | |
4356 | 4355 | | |
4357 | | - | |
4358 | | - | |
4359 | | - | |
4360 | | - | |
4361 | | - | |
4362 | | - | |
4363 | | - | |
4364 | | - | |
4365 | | - | |
4366 | | - | |
4367 | | - | |
4368 | | - | |
4369 | | - | |
4370 | | - | |
4371 | | - | |
4372 | | - | |
4373 | | - | |
4374 | | - | |
4375 | | - | |
4376 | | - | |
4377 | | - | |
4378 | | - | |
4379 | | - | |
4380 | | - | |
4381 | | - | |
4382 | | - | |
4383 | | - | |
4384 | | - | |
4385 | | - | |
4386 | | - | |
4387 | | - | |
4388 | | - | |
4389 | | - | |
4390 | | - | |
4391 | | - | |
4392 | | - | |
4393 | | - | |
4394 | | - | |
4395 | | - | |
4396 | | - | |
4397 | | - | |
4398 | 4356 | | |
4399 | 4357 | | |
4400 | 4358 | | |
| |||
4501 | 4459 | | |
4502 | 4460 | | |
4503 | 4461 | | |
4504 | | - | |
4505 | | - | |
4506 | | - | |
4507 | 4462 | | |
4508 | 4463 | | |
4509 | 4464 | | |
| |||
4622 | 4577 | | |
4623 | 4578 | | |
4624 | 4579 | | |
4625 | | - | |
4626 | 4580 | | |
4627 | | - | |
4628 | | - | |
4629 | | - | |
4630 | | - | |
4631 | | - | |
4632 | | - | |
4633 | | - | |
4634 | | - | |
4635 | | - | |
4636 | | - | |
4637 | | - | |
4638 | | - | |
4639 | | - | |
4640 | | - | |
4641 | | - | |
4642 | 4581 | | |
4643 | 4582 | | |
4644 | 4583 | | |
| |||
4650 | 4589 | | |
4651 | 4590 | | |
4652 | 4591 | | |
4653 | | - | |
4654 | | - | |
4655 | 4592 | | |
4656 | 4593 | | |
4657 | 4594 | | |
| |||
0 commit comments