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]

Re: [PATCH] Improve qsort_cmp performance by memoizing objfile data


>>>>> "Vijay" == Vijay Klein <vijaygk2@illinois.edu> writes:

Vijay> RATIONALE: The rationale behind this patch is that, currently, the
Vijay> qsort_cmp function can fall into a default case where it linearly
Vijay> traverses all the objfiles.

Thank you for the patch.

I'm curious if you have seen this code path taken.

Vijay> FSF Copyright Assignment: To be completely honest, I'm not entirely
Vijay> sure what is required here. I designed and wrote the entire change, if
Vijay> that is relevant. On the contribution checklist, it said the reviewer
Vijay> would send me the proper form, so all help is appreciated!

I don't think I have the forms available any more.  Maybe one of the
other maintainers can email you the appropriate one; or you can email
assign@gnu for the paperwork.

Vijay> +  int index;
... 
Vijay> -  section = &objfile->sections[gdb_bfd_section_index (abfd, asect)];
Vijay> +  index = gdb_bfd_section_index (abfd, asect);

Better nowadays to just write "int index = ...".

Vijay> +/* Must be called whenever the order of the linked list is edited, to ensure
Vijay> +   the comparison function has up to date info. Freeing an objfile does not
Vijay> +   require this function, as the order is maintained, but a function like
Vijay> +   `put_objfile_before` should certainly call this.  */
Vijay> +void
Vijay> +update_objfile_ids (void)

It seems to me that there isn't a deep reason to prefer exactly the
order of the objfiles in the list -- any consistent order seems fine.
So, how about just setting the objfile's "id" at creation time, and
using that?

Then this function wouldn't be needed.

Vijay> +  /* Memoized BFD section index returned from gdb_bfd_section_index  */
Vijay> +  int index;

GNU style is to have a period (followed by 2 spaces) at the end of
comment.

Vijay> +  /* A unique sequence identifier for the global linked list */

Here too.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]