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

Re: [PATCH] split_ident: parse timestamp from end of line

From
Jeff King <peff@peff.net>
Date
Oct 15, 2013, 18:03 UTC
Message-ID
<20131015180312.GA26845@sigill.intra.peff.net>
In-Reply-To
<xmqqob6qe808.fsf@gitster.dls.corp.google.com>
On Tue, Oct 15, 2013 at 10:52:55AM -0700, Junio C Hamano wrote:
Show 13 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> >> Yeah, unrolling the loop is probably better.  You may even be able
> >> to do so in a single pass with an extra "last > seen" pointer
> >> variable without too much additional code complexity, I would think.
> >
> > I'm not sure what you mean here.
> 
> > If you mean doing a single pass to find the final ">", that is easy,
> > because we know the length of the line already and can jump past and
> > start from the back.
> 
> I meant a single forward pass, like this.
Ah, I see. You are combining with the pass before, not the pass after.

I do not think this is any more (nor less) efficient than what I posted. We still pass over the space after split->mail_end one additional time searching for the closing bracket. Mine is _slightly_ more efficient in that by going backwards we can stop when we see the first '>', avoiding looking at the space between "mail_end" and "last_ket". But that space is 0 in the normal case, and even if it is not, we are talking about tens of bytes at most. So I doubt it would ever matter.

My version seems a little clearer to me, but that is probably because I wrote it. If you strongly prefer the other, feel free to mark up my patch.

-Peff
PS I learned a new term, "ket". I always called it "closing angle
   bracket".
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 9 in “split_ident: parse timestamp from end of line”
  1. split_ident: parse timestamp from end of lineJeff King, Oct 14, 2013
  2. Junio C HamanoOct 14, 2013
  3. Jeff KingOct 14, 2013
  4. Jeff KingOct 14, 2013
  5. Junio C HamanoOct 14, 2013
  6. Jeff KingOct 14, 2013
  7. Junio C HamanoOct 15, 2013
  8. Jeff KingOct 15, 2013
  9. Junio C HamanoOct 15, 2013

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.