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

Re: [PATCH 2/8] sha1_file: introduce has_object_file helper.

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Jun 10, 2015, 13:55 UTC
Message-ID
<20150610135555.GD664685@vauxhall.crustytoothpaste.net>
In-Reply-To
<CACsJy8DHJ415euwo3gMTtuQx+5RopzBg+mssZ8TVstGJcdWSqg@mail.gmail.com>
On Wed, Jun 10, 2015 at 04:59:58PM +0700, Duy Nguyen wrote:
Show 20 quoted lines
> On Tue, Jun 9, 2015 at 11:28 PM, brian m. carlson
> <sandals@crustytoothpaste.net> wrote:
> > diff --git a/sha1_file.c b/sha1_file.c
> > index 7e38148..09f7f03 100644
> > --- a/sha1_file.c
> > +++ b/sha1_file.c
> > @@ -3173,6 +3173,11 @@ int has_sha1_file(const unsigned char *sha1)
> >         return find_pack_entry(sha1, &e);
> >  }
> >
> > +int has_object_file(const struct object_id *oid)
> > +{
> > +       return has_sha1_file(oid->hash);
> > +}
> > +
> 
> This version could be "static inline" and placed in cache.h. Though it
> may be premature optimization. On top of my head I can't recall any
> place where has_sha1_file() is used so many times for this extra call
> to become significant overhead.

I planned on merging the two into has_object_file when has_sha1_file has no more callers, so it's more of an incidental artifact that one calls the other rather than a long-term goal. In the branch I'm working on now, I'm down to 27 callers, so it may be rather soon that it goes away.

Of course, if the consensus is that the performance increase is worth it in the mean time, I can certainly just move it back when they merge.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
Previous: Duy NguyenNext: brian m. carlson
Message 5 of 23 in “object_id part 2”
  1. 0/8 object_id part 2brian m. carlson, Jun 9, 2015
  2. 1/8 refs: convert some internal functions to use object_idbrian m. carlson, Jun 9, 2015
  3. 2/8 sha1_file: introduce has_object_file helper.brian m. carlson, Jun 9, 2015
  4. Duy NguyenJun 10, 2015
  5. brian m. carlsonJun 10, 2015
  6. 3/8 Convert struct ref to use object_id.brian m. carlson, Jun 9, 2015
  7. Michael HaggertyJun 11, 2015
  8. 4/8 Add a utility function to make parsing hex values easier.brian m. carlson, Jun 9, 2015
  9. Michael HaggertyJun 11, 2015
  10. 5/8 add_sought_entry_mem: convert to struct object_idbrian m. carlson, Jun 9, 2015
  11. 6/8 parse_fetch: convert to use struct object_idbrian m. carlson, Jun 9, 2015
  12. 7/8 ref_newer: convert to use struct object_idbrian m. carlson, Jun 9, 2015
  13. Junio C HamanoJun 10, 2015
  14. brian m. carlsonJun 10, 2015
  15. brian m. carlsonJun 11, 2015
  16. Junio C HamanoJun 11, 2015
  17. brian m. carlsonJun 11, 2015
  18. Junio C HamanoJun 11, 2015
  19. brian m. carlsonJun 12, 2015
  20. Junio C HamanoJun 12, 2015
  21. brian m. carlsonJun 12, 2015
  22. Michael HaggertyJun 13, 2015
  23. brian m. carlsonJun 13, 2015

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.