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

[PATCH 0/2] [GSOC][RFC] ref-filter: introduce enum atom_type

From
ZheNing Hu via GitGitGadget <gitgitgadget@gmail.com>
Date
May 8, 2021, 15:22 UTC
Message-ID
<pull.951.git.1620487353.gitgitgadget@gmail.com>

Firstly, let the union used_atom.u add a member "objectsize",which learn to record the attributes of "objectsize", this will bring an extension line for atom "%(objectsize)". Next patch will base on this feature to better support its functions.

Secondly, In https://lore.kernel.org/git/CAOLTT8RhVZQJX8z1gY5UM1jv0imZ4K9UnD14MgJFfvqBBiAZQg@mail.gmail.com/ I and Junio discussed the use of enum atom_type in used_atom to represent the specific type of union used_atom.u, which can correctly distinguish atom types and reduce the overhead of string matching.

But after my attempts, I found that our used_atom is better using enum to remember the type of valid_atom item instead of remember type of used_atom.u, which can be used throughout the ref-filter, easily distinguish different types of atoms through a used_atom[i].atom_type, and reduce the overhead of string matching.

What's left: some function like grab_oid() or grab_person(), they can also take advantage of this feature, but require some additional modifications.

What's for future: Let used_atom entry can index directly by enum atom_type, In order to reduce the very many loops in ref-filter.

E.g.

static struct used_atom_cache { enum atom_type atom_type; struct used_atom *used_atom; } used_atom_cache[] = { {ATOM_REFNAME, NULL}, {ATOM_OBJECTTYPE, NULL}, ... };

If want check whether used_atom entries have a atom "%(refname)", we can just check if used_atom_cache[ATOM_REFNAME].used_atom is equal to NULL, the time complexity is O(1) and the complexity of the original method is O(n). This will once again get a performance boost for ref-filter.

ZheNing Hu (2):
  [GSOC] ref-filter: add objectsize to used_atom
  [GSOC][RFC] ref-filter: introduce enum atom_type
 ref-filter.c | 209 +++++++++++++++++++++++++++++++++------------------
 1 file changed, 135 insertions(+), 74 deletions(-)
base-commit: 7e391989789db82983665667013a46eabc6fc570
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-951%2Fadlternative%2Fref-filter-atom-type-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-951/adlternative/ref-filter-atom-type-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/951
-- 
gitgitgadget
Next: ZheNing Hu via GitGitGadget
Message 1 of 27 in “[GSOC][RFC] ref-filter: introduce enum atom_type”
  1. 0/2 [GSOC][RFC] ref-filter: introduce enum atom_typeZheNing Hu via GitGitGadget, May 8, 2021
  2. 1/2 [GSOC] ref-filter: add objectsize to used_atomZheNing Hu via GitGitGadget, May 8, 2021
  3. 2/2 [GSOC][RFC] ref-filter: introduce enum atom_typeZheNing Hu via GitGitGadget, May 8, 2021
  4. Christian CouderMay 9, 2021
  5. Junio C HamanoMay 9, 2021
  6. ZheNing HuMay 9, 2021
  7. ZheNing HuMay 9, 2021
  8. 0/2 [GSOC][RFC] ref-filter: introduce enum atom_typeZheNing Hu via GitGitGadget, May 10, 2021
  9. 1/2 [GSOC] ref-filter: add objectsize to used_atomZheNing Hu via GitGitGadget, May 10, 2021
  10. 2/2 [GSOC] ref-filter: introduce enum atom_typeZheNing Hu via GitGitGadget, May 10, 2021
  11. Junio C HamanoMay 11, 2021
  12. Christian CouderMay 11, 2021
  13. Junio C HamanoMay 11, 2021
  14. ZheNing HuMay 11, 2021
  15. ZheNing HuMay 11, 2021
  16. Junio C HamanoMay 11, 2021
  17. ZheNing HuMay 11, 2021
  18. 0/2 [GSOC][RFC] ref-filter: introduce enum atom_typeZheNing Hu via GitGitGadget, May 12, 2021
  19. 1/2 [GSOC] ref-filter: add objectsize to used_atomZheNing Hu via GitGitGadget, May 12, 2021
  20. Junio C HamanoMay 12, 2021
  21. ZheNing HuMay 13, 2021
  22. 2/2 [GSOC] ref-filter: introduce enum atom_typeZheNing Hu via GitGitGadget, May 12, 2021
  23. Junio C HamanoMay 12, 2021
  24. ZheNing HuMay 13, 2021
  25. 0/2 [GSOC][RFC] ref-filter: introduce enum atom_typeZheNing Hu via GitGitGadget, May 13, 2021
  26. 1/2 [GSOC] ref-filter: add objectsize to used_atomZheNing Hu via GitGitGadget, May 13, 2021
  27. 2/2 [GSOC] ref-filter: introduce enum atom_typeZheNing Hu via GitGitGadget, May 13, 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.