git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 3/4] diffcore-rename: guide inexact rename detection based on basenames

From
Elijah Newren <newren@gmail.com>
Date
Feb 9, 2021, 17:41 UTC
Message-ID
<CABPp-BFfF5rxbHwP1xnr63fPmp2=NkTZ-r0=FVZ1oVhAZD_s9w@mail.gmail.com>
In-Reply-To
<48a208c2-75fe-773e-aa2a-12a90dd06ddd@gmail.com>
On Tue, Feb 9, 2021 at 5:33 AM Derrick Stolee <stolee@gmail.com> wrote:
Show 44 quoted lines
>
> On 2/9/2021 6:32 AM, Elijah Newren via GitGitGadget wrote:
> > +     num_sources = rename_src_nr;
> > +
> > +     if (want_copies || break_idx) {
> > +             /*
> > +              * Cull sources:
> > +              *   - remove ones corresponding to exact renames
> > +              */
> > +             trace2_region_enter("diff", "cull after exact", options->repo);
> > +             remove_unneeded_paths_from_src(want_copies);
> > +             trace2_region_leave("diff", "cull after exact", options->repo);
>
> Isn't this the same as
>
> > +     } else {
> > +             /* Determine minimum score to match basenames */
> > +             int min_basename_score = (int)(5*minimum_score + 0*MAX_SCORE)/5;
> > +
> > +             /*
> > +              * Cull sources:
> > +              *   - remove ones involved in renames (found via exact match)
> > +              */
> > +             trace2_region_enter("diff", "cull exact", options->repo);
> > +             remove_unneeded_paths_from_src(want_copies);
> > +             trace2_region_leave("diff", "cull exact", options->repo);
>
> ...this? (except the regions are renamed)
>
> Could this be simplified as:
>
> +       num_sources = rename_src_nr;
> +
> +       trace2_region_enter("diff", "cull after exact", options->repo);
> +       remove_unneeded_paths_from_src(want_copies);
> +       trace2_region_leave("diff", "cull after exact", options->repo);
> +
> +       if (!want_copies && !break_idx) {
> +               /* Determine minimum score to match basenames */
>
> I realize you probably changed the region names on purpose to distinguish
> that there are two "cull" regions in the case of no copies, but I think
> that isn't really worth different names. Better to have a consistent region
> name around the same activity in both cases.

Actually, the reason they were split is because a later series has to call remove_unneeded_paths_from_src() differently for the two branches. The patch history was so dirty that the easiest way to clean things up was just to create completely new patches pulling off relevant chunks of code and touching them up; while doing that, I didn't notice that the changes I made to split out this early series resulted in this near-duplication.

So, I can join them...but they would just need to be split back out in my "Optimization batch 9" series.

I'm happy to fix the region name to make them the same. Is that good enough, or would you rather these common code regions combined for this patch and then split out later?

Show 5 quoted lines
>
> > +             int min_basename_score = (int)(5*minimum_score + 0*MAX_SCORE)/5;
>
> Did you intend for this to be 5*min + 0*MAX? This seems wrong if you want
> this value to be different from minimum_score.

In my cover letter I noted that I didn't know what to set this to and wanted input; yesterday you said it wasn't worth worrying about using a different value, but Junio suggested we should use one (but didn't state how much higher it should be or whether it should be user input driven). This weird construct was here just to show that it is easy to feed a different score into the basename comparison than what is used elsewhere; I can fix it up once I get word on what Junio wants to see.

Since I didn't know what to use, though, and I didn't want to get a different set of numbers for the final commit message on the speedup achieved if I'm just going to throw them away and recompute once I find out what Junio wants here, I did intentionally set the computation to just give us minimum_score, for now.

Show 20 quoted lines
> > +
> > +             /* Utilize file basenames to quickly find renames. */
> > +             trace2_region_enter("diff", "basename matches", options->repo);
> > +             rename_count += find_basename_matches(options,
> > +                                                   min_basename_score,
> > +                                                   rename_src_nr);
> > +             trace2_region_leave("diff", "basename matches", options->repo);
> > +
> > +             /*
> > +              * Cull sources, again:
> > +              *   - remove ones involved in renames (found via basenames)
> > +              */
> > +             trace2_region_enter("diff", "cull basename", options->repo);
> > +             remove_unneeded_paths_from_src(want_copies);
> > +             trace2_region_leave("diff", "cull basename", options->repo);
> > +     }
> > +
>
> Thanks,
> -Stolee
Previous: Derrick StoleeNext: Junio C Hamano
Message 26 of 71 in “Optimization batch 7: use file basenames to guide rename detection”
  1. 0/3 Optimization batch 7: use file basenames to guide rename detectionElijah Newren via GitGitGadget, Feb 6, 2021
  2. 1/3 diffcore-rename: compute basenames of all source and dest candidatesElijah Newren via GitGitGadget, Feb 6, 2021
  3. 2/3 diffcore-rename: complete find_basename_matches()Elijah Newren via GitGitGadget, Feb 6, 2021
  4. 3/3 diffcore-rename: guide inexact rename detection based on basenamesElijah Newren via GitGitGadget, Feb 6, 2021
  5. Derrick StoleeFeb 7, 2021
  6. Junio C HamanoFeb 7, 2021
  7. Elijah NewrenFeb 8, 2021
  8. Derrick StoleeFeb 8, 2021
  9. Elijah NewrenFeb 8, 2021
  10. Junio C HamanoFeb 8, 2021
  11. Elijah NewrenFeb 8, 2021
  12. Junio C HamanoFeb 8, 2021
  13. Elijah NewrenFeb 8, 2021
  14. Elijah NewrenFeb 8, 2021
  15. Derrick StoleeFeb 8, 2021
  16. Elijah NewrenFeb 8, 2021
  17. Junio C HamanoFeb 7, 2021
  18. Elijah NewrenFeb 7, 2021
  19. 0/4 Optimization batch 7: use file basenames to guide rename detectionElijah Newren via GitGitGadget, Feb 9, 2021
  20. 2/4 diffcore-rename: complete find_basename_matches()Elijah Newren via GitGitGadget, Feb 9, 2021
  21. Derrick StoleeFeb 9, 2021
  22. Elijah NewrenFeb 9, 2021
  23. Derrick StoleeFeb 9, 2021
  24. 3/4 diffcore-rename: guide inexact rename detection based on basenamesElijah Newren via GitGitGadget, Feb 9, 2021
  25. Derrick StoleeFeb 9, 2021
  26. Elijah NewrenFeb 9, 2021
  27. Junio C HamanoFeb 9, 2021
  28. 1/4 diffcore-rename: compute basenames of all source and dest candidatesElijah Newren via GitGitGadget, Feb 9, 2021
  29. Derrick StoleeFeb 9, 2021
  30. Elijah NewrenFeb 9, 2021
  31. Derrick StoleeFeb 9, 2021
  32. Elijah NewrenFeb 9, 2021
  33. 4/4 gitdiffcore doc: mention new preliminary step for rename detectionElijah Newren via GitGitGadget, Feb 9, 2021
  34. Derrick StoleeFeb 9, 2021
  35. Junio C HamanoFeb 9, 2021
  36. Elijah NewrenFeb 9, 2021
  37. 0/5 Optimization batch 7: use file basenames to guide rename detectionElijah Newren via GitGitGadget, Feb 10, 2021
  38. 1/5 t4001: add a test comparing basename similarity and content similarityElijah Newren via GitGitGadget, Feb 10, 2021
  39. Junio C HamanoFeb 13, 2021
  40. Elijah NewrenFeb 13, 2021
  41. Junio C HamanoFeb 13, 2021
  42. Elijah NewrenFeb 14, 2021
  43. Junio C HamanoFeb 14, 2021
  44. Elijah NewrenFeb 14, 2021
  45. 2/5 diffcore-rename: compute basenames of all source and dest candidatesElijah Newren via GitGitGadget, Feb 10, 2021
  46. Junio C HamanoFeb 13, 2021
  47. 4/5 diffcore-rename: guide inexact rename detection based on basenamesElijah Newren via GitGitGadget, Feb 10, 2021
  48. Junio C HamanoFeb 13, 2021
  49. 3/5 diffcore-rename: complete find_basename_matches()Elijah Newren via GitGitGadget, Feb 10, 2021
  50. Junio C HamanoFeb 13, 2021
  51. Elijah NewrenFeb 13, 2021
  52. Junio C HamanoFeb 13, 2021
  53. Elijah NewrenFeb 14, 2021
  54. 5/5 gitdiffcore doc: mention new preliminary step for rename detectionElijah Newren via GitGitGadget, Feb 10, 2021
  55. Junio C HamanoFeb 10, 2021
  56. Elijah NewrenFeb 10, 2021
  57. 0/6 Optimization batch 7: use file basenames to guide rename detectionElijah Newren via GitGitGadget, Feb 11, 2021
  58. 1/6 t4001: add a test comparing basename similarity and content similarityElijah Newren via GitGitGadget, Feb 11, 2021
  59. 2/6 diffcore-rename: compute basenames of all source and dest candidatesElijah Newren via GitGitGadget, Feb 11, 2021
  60. 3/6 diffcore-rename: complete find_basename_matches()Elijah Newren via GitGitGadget, Feb 11, 2021
  61. 5/6 gitdiffcore doc: mention new preliminary step for rename detectionElijah Newren via GitGitGadget, Feb 11, 2021
  62. 4/6 diffcore-rename: guide inexact rename detection based on basenamesElijah Newren via GitGitGadget, Feb 11, 2021
  63. 6/6 merge-ort: call diffcore_rename() directlyElijah Newren via GitGitGadget, Feb 11, 2021
  64. Junio C HamanoFeb 13, 2021
  65. 0/6 Optimization batch 7: use file basenames to guide rename detectionElijah Newren via GitGitGadget, Feb 14, 2021
  66. 3/6 diffcore-rename: complete find_basename_matches()Elijah Newren via GitGitGadget, Feb 14, 2021
  67. 5/6 gitdiffcore doc: mention new preliminary step for rename detectionElijah Newren via GitGitGadget, Feb 14, 2021
  68. 1/6 t4001: add a test comparing basename similarity and content similarityElijah Newren via GitGitGadget, Feb 14, 2021
  69. 2/6 diffcore-rename: compute basenames of source and dest candidatesElijah Newren via GitGitGadget, Feb 14, 2021
  70. 4/6 diffcore-rename: guide inexact rename detection based on basenamesElijah Newren via GitGitGadget, Feb 14, 2021
  71. 6/6 merge-ort: call diffcore_rename() directlyElijah Newren via GitGitGadget, Feb 14, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.