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

Re: [PATCH 1/5] Allow alternate "low-level" emit function from xdl_diff

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 23, 2008, 09:03 UTC
Message-ID
<7vy72o14tw.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<48AFC73F.2010100@lsrfire.ath.cx>
René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:
Show 33 quoted lines
> Could we move more code into the library code to avoid that ugliness?
>
> AFAICS, compare_buffer() builds a struct patch with an array of
> struct chunks, whose members are then fed one by one into either
> blame_chunk() or handle_split().  Could we avoid the allocation
> altogether by using a different interface?
>
> E.g. have a callback like this:
>
> 	static void handle_split_cb(long same, long p_next, long t_next,
> 			void *data)
> 	{
> 		struct chunk_cb_data *d = data;
> 		handle_split(d->sb, d->ent, d->tlno, d->plno, same,
> 				d->parent, d->split);
> 		d->plno = p_next;
> 		d->tlno = t_next;
> 	}
>
> And use it like this:
>
> 	struct chunk_cb_data d = {sb, ent, 0, 0, parent, split};
>         xpparam_t xpp;
>         xdemitconf_t xecfg;
>
>         xpp.flags = xdl_opts;
>         memset(&xecfg, 0, sizeof(xecfg));
>         xecfg.ctxlen = context;
> 	xdi_diff_chunks(file_p, file_o, &xpp, &xecfg, handle_split_cb, &d);
>         handle_split(sb, ent, d.tlno, d.plno, ent->num_lines,
> 			parent, split);
>
> Makes sense?
Absolutely; very well formulated.  Thanks.
Previous: René ScharfeNext: Brian Downing
Message 8 of 17 in “More git blame speed improvements”
  1. 0/5 More git blame speed improvementsBrian Downing, Aug 21, 2008
  2. 1/5 Allow alternate "low-level" emit function from xdl_diffBrian Downing, Aug 21, 2008
  3. 2/5 Bypass textual patch generation and parsing in git blameBrian Downing, Aug 21, 2008
  4. 3/5 Always initialize xpparam_t to 0Brian Downing, Aug 21, 2008
  5. 4/5 Allow xdiff machinery to cache hash results for a fileBrian Downing, Aug 21, 2008
  6. 5/5 Use xdiff caching to improve git blame performanceBrian Downing, Aug 21, 2008
  7. René ScharfeAug 23, 2008
  8. Junio C HamanoAug 23, 2008
  9. Brian DowningAug 24, 2008
  10. René ScharfeSep 3, 2008
  11. 1/5 blame: inline get_patch()René Scharfe, Oct 25, 2008
  12. 2/5 Always initialize xpparam_t to 0René Scharfe, Oct 25, 2008
  13. 3/5 Allow alternate "low-level" emit function from xdl_diffRené Scharfe, Oct 25, 2008
  14. 4/5 add xdi_diff_hunks() for callers that only need hunk lengthsRené Scharfe, Oct 25, 2008
  15. 5/5 blame: use xdi_diff_hunks(), get rid of struct patchRené Scharfe, Oct 25, 2008
  16. Junio C HamanoOct 25, 2008
  17. René ScharfeOct 26, 2008

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.