This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Greetings, While working on something else, I noticed find_pc_section consuming 90%+ of CPU in my GDB profiles :-( It is called from quite a number of places, and is surprisingly inefficient. Further, it exhibits yet another quadratic slowdown on number of objfiles, as the attached test case demonstrates. Running "perl gen.pl NNN" generates NNN shared libs, and a main executable, which crashes with NNN+C levels in stack trace, crossing all shared libs. I then collected timing like this: time gdb64-cvs -ex run -ex where -ex quit ./a.out > /dev/null Here are user-time results before the patch (clearly showing non-linear slowdown): 32: 0m0.426s 64: 0m1.344s 128: 0m5.254s 256: 0m35.792s 512: 4m55.999s Attached patch turns linear search into binary search, speeding up find_pc_section drastically :-) Here are the same user-time results after the patch: 128: 0m1.064s 256: 0m3.062s 512: 0m10.675s Tested on Linux/x86_64 with no regressions. Comments? -- Paul Pluzhnikov
Attachment:
gdb-find_pc_section-20090716.txt
Description: Text document
Attachment:
gen.pl
Description: Perl program
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |