git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
	Christian Couder <chriscool@tuxfamily.org>,
	Hariom Verma <hariom18599@gmail.com>,
	ZheNing Hu <adlternative@gmail.com>
Subject: [PATCH 0/2] [GSOC][RFC] ref-filter: introduce enum atom_type
Date: Sat, 08 May 2021 15:22:30 +0000	[thread overview]
Message-ID: <pull.951.git.1620487353.gitgitgadget@gmail.com> (raw)

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

             reply	other threads:[~2021-05-08 15:22 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-08 15:22 ZheNing Hu via GitGitGadget [this message]
2021-05-08 15:22 ` [PATCH 1/2] [GSOC] ref-filter: add objectsize to used_atom ZheNing Hu via GitGitGadget
2021-05-08 15:22 ` [PATCH 2/2] [GSOC][RFC] ref-filter: introduce enum atom_type ZheNing Hu via GitGitGadget
2021-05-09  6:21   ` Christian Couder
2021-05-09  8:26     ` Junio C Hamano
2021-05-09 13:44       ` ZheNing Hu
2021-05-09 13:40     ` ZheNing Hu
2021-05-10 15:03 ` [PATCH v2 0/2] " ZheNing Hu via GitGitGadget
2021-05-10 15:03   ` [PATCH v2 1/2] [GSOC] ref-filter: add objectsize to used_atom ZheNing Hu via GitGitGadget
2021-05-10 15:03   ` [PATCH v2 2/2] [GSOC] ref-filter: introduce enum atom_type ZheNing Hu via GitGitGadget
2021-05-11  2:14     ` Junio C Hamano
2021-05-11  5:51       ` Christian Couder
2021-05-11  6:12         ` Junio C Hamano
2021-05-11 12:53           ` ZheNing Hu
2021-05-11 12:37         ` ZheNing Hu
2021-05-11 13:05         ` Junio C Hamano
2021-05-11 12:18       ` ZheNing Hu
2021-05-12 12:11   ` [PATCH v3 0/2] [GSOC][RFC] " ZheNing Hu via GitGitGadget
2021-05-12 12:11     ` [PATCH v3 1/2] [GSOC] ref-filter: add objectsize to used_atom ZheNing Hu via GitGitGadget
2021-05-12 23:11       ` Junio C Hamano
2021-05-13  9:04         ` ZheNing Hu
2021-05-12 12:11     ` [PATCH v3 2/2] [GSOC] ref-filter: introduce enum atom_type ZheNing Hu via GitGitGadget
2021-05-12 23:21       ` Junio C Hamano
2021-05-13  9:25         ` ZheNing Hu
2021-05-13 15:15     ` [PATCH v4 0/2] [GSOC][RFC] " ZheNing Hu via GitGitGadget
2021-05-13 15:15       ` [PATCH v4 1/2] [GSOC] ref-filter: add objectsize to used_atom ZheNing Hu via GitGitGadget
2021-05-13 15:15       ` [PATCH v4 2/2] [GSOC] ref-filter: introduce enum atom_type ZheNing Hu via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.951.git.1620487353.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=adlternative@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hariom18599@gmail.com \
    --cc=peff@peff.net \
    --subject='Re: [PATCH 0/2] [GSOC][RFC] ref-filter: introduce enum atom_type' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).