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

Re: [PATCH] Revert removal of multi-match discard heuristic in 27af01

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Sep 25, 2011, 17:53 UTC
Message-ID
<4E7F6A9F.6050501@lsrfire.ath.cx>
In-Reply-To
<1316957948-1908-1-git-send-email-rctay89@gmail.com>
Am 25.09.2011 15:39, schrieb Tay Ray Chuan:
Show 23 quoted lines
> From: René Scharfe <rene.scharfe@lsrfire.ath.cx>
> 
> 27af01d (xdiff/xprepare: improve O(n*m) performance in
> xdl_cleanup_records(), 2011-08-17) was supposed to be a performance
> boost only. However, it unexpectedly changed the behaviour of diff.
> 
> Revert a part of 27af01d that removes logic that mark lines as
> "multi-match" (ie. dis[i] == 2). This was preventing the multi-match
> discard heuristic (performed in xdl_cleanup_records() and
> xdl_clean_mmatch()) from executing.
> 
> Reported-by: Alexander Pepper <pepper@inf.fu-berlin.de>
> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
> 
> ---
> 
> Junio, this replaces the patch the one in the
> 'rs/diff-cleanup-records-fix' topic in 'pu'. The only difference is in
> the patch message.
> 
> René, will need your SOB on this. Thanks for working to produce the
> patch. Please disregard my earlier message [1], further reading has
> shown my previous understanding to be wrong.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Show 42 quoted lines
> 
> [1] <CALUzUxprUFGMR-WVEMOOvYiwkev1cfxHOyBmZq9bKJcHq5E2VA@mail.gmail.com>
> ---
>  xdiff/xprepare.c |   10 +++++++---
>  1 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/xdiff/xprepare.c b/xdiff/xprepare.c
> index 05a8f01..4c447ca 100644
> --- a/xdiff/xprepare.c
> +++ b/xdiff/xprepare.c
> @@ -398,7 +398,7 @@ static int xdl_clean_mmatch(char const *dis, long i, long s, long e) {
>   * might be potentially discarded if they happear in a run of discardable.
>   */
>  static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xdf2) {
> -	long i, nm, nreff;
> +	long i, nm, nreff, mlim;
>  	xrecord_t **recs;
>  	xdlclass_t *rcrec;
>  	char *dis, *dis1, *dis2;
> @@ -411,16 +411,20 @@ static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xd
>  	dis1 = dis;
>  	dis2 = dis1 + xdf1->nrec + 1;
>  
> +	if ((mlim = xdl_bogosqrt(xdf1->nrec)) > XDL_MAX_EQLIMIT)
> +		mlim = XDL_MAX_EQLIMIT;
>  	for (i = xdf1->dstart, recs = &xdf1->recs[xdf1->dstart]; i <= xdf1->dend; i++, recs++) {
>  		rcrec = cf->rcrecs[(*recs)->ha];
>  		nm = rcrec ? rcrec->len2 : 0;
> -		dis1[i] = (nm == 0) ? 0: 1;
> +		dis1[i] = (nm == 0) ? 0: (nm >= mlim) ? 2: 1;
>  	}
>  
> +	if ((mlim = xdl_bogosqrt(xdf2->nrec)) > XDL_MAX_EQLIMIT)
> +		mlim = XDL_MAX_EQLIMIT;
>  	for (i = xdf2->dstart, recs = &xdf2->recs[xdf2->dstart]; i <= xdf2->dend; i++, recs++) {
>  		rcrec = cf->rcrecs[(*recs)->ha];
>  		nm = rcrec ? rcrec->len1 : 0;
> -		dis2[i] = (nm == 0) ? 0: 1;
> +		dis2[i] = (nm == 0) ? 0: (nm >= mlim) ? 2: 1;
>  	}
>  
>  	for (nreff = 0, i = xdf1->dstart, recs = &xdf1->recs[xdf1->dstart];
Previous: Tay Ray ChuanNext: Junio C Hamano
Message 11 of 16 in “Bug: git log --numstat counts wrong”
  1. Alexander PepperSep 21, 2011
  2. Junio C HamanoSep 21, 2011
  3. Alexander PepperSep 21, 2011
  4. Alexander PepperSep 21, 2011
  5. Junio C HamanoSep 21, 2011
  6. Alexander PepperSep 22, 2011
  7. Junio C HamanoSep 22, 2011
  8. René ScharfeSep 22, 2011
  9. Tay Ray ChuanSep 23, 2011
  10. Revert removal of multi-match discard heuristic in 27af01Tay Ray Chuan, Sep 25, 2011
  11. René ScharfeSep 25, 2011
  12. Junio C HamanoSep 22, 2011
  13. Tay Ray ChuanSep 23, 2011
  14. Tay Ray ChuanSep 23, 2011
  15. Junio C HamanoSep 23, 2011
  16. Alexander PepperSep 23, 2011

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.