From: Alejandro Colomar <alx.manpages@gmail.com>
To: Git Mailing List <git@vger.kernel.org>,
Alejandro Colomar <alx@nginx.com>
Subject: Dubious diff using --diff-algorithm=histogram
Date: Tue, 4 Apr 2023 21:51:21 +0200 [thread overview]
Message-ID: <a0b6d751-25fd-a132-f8a5-9844e5d9b8a6@gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 2802 bytes --]
Hi,
I've met some strange diff with the histogram algorithm. I know this
has a lot of magic in it, and it's probably not so trivial to improve,
and maybe my code base is so weird that it makes the histogram do crazy
stuff, but I wanted to show it to you in case there's anything that can
be improved.
So, patience is showing a better diff than histogram, which shouldn't
happen usually, and less in this case, where p++ is such a common thing
to do (although maybe this nxt_slow_path() macro is called a lot in the
file and confuses the histogram?).
Code base: <https://github.com/nginx/unit.git>
Cheers,
Alex
---
alx@asus5775:~/src/nginx/unit/space$ git diff --diff-algorithm=histogram
diff --git a/src/nxt_http_parse.c b/src/nxt_http_parse.c
index 8646a6ce..92bdfb1f 100644
--- a/src/nxt_http_parse.c
+++ b/src/nxt_http_parse.c
@@ -340,10 +340,10 @@ nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos,
space_after_target:
- if (nxt_slow_path(end - p < 10)) {
-
p++;
+ if (nxt_slow_path(end - p < 10)) {
+
if (p == end) {
return NXT_AGAIN;
}
alx@asus5775:~/src/nginx/unit/space$ git diff --diff-algorithm=patience
diff --git a/src/nxt_http_parse.c b/src/nxt_http_parse.c
index 8646a6ce..92bdfb1f 100644
--- a/src/nxt_http_parse.c
+++ b/src/nxt_http_parse.c
@@ -340,10 +340,10 @@ nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos,
space_after_target:
+ p++;
+
if (nxt_slow_path(end - p < 10)) {
- p++;
-
if (p == end) {
return NXT_AGAIN;
}
alx@asus5775:~/src/nginx/unit/space$ git diff --diff-algorithm=myers
diff --git a/src/nxt_http_parse.c b/src/nxt_http_parse.c
index 8646a6ce..92bdfb1f 100644
--- a/src/nxt_http_parse.c
+++ b/src/nxt_http_parse.c
@@ -340,10 +340,10 @@ nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos,
space_after_target:
- if (nxt_slow_path(end - p < 10)) {
-
p++;
+ if (nxt_slow_path(end - p < 10)) {
+
if (p == end) {
return NXT_AGAIN;
}
alx@asus5775:~/src/nginx/unit/space$ git diff --diff-algorithm=minimal
diff --git a/src/nxt_http_parse.c b/src/nxt_http_parse.c
index 8646a6ce..92bdfb1f 100644
--- a/src/nxt_http_parse.c
+++ b/src/nxt_http_parse.c
@@ -340,10 +340,10 @@ nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos,
space_after_target:
- if (nxt_slow_path(end - p < 10)) {
-
p++;
+ if (nxt_slow_path(end - p < 10)) {
+
if (p == end) {
return NXT_AGAIN;
}
--
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next reply other threads:[~2023-04-04 19:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-04 19:51 Alejandro Colomar [this message]
2023-04-04 19:53 ` Dubious diff using --diff-algorithm=histogram Alejandro Colomar
2023-04-28 21:36 ` Alejandro Colomar
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=a0b6d751-25fd-a132-f8a5-9844e5d9b8a6@gmail.com \
--to=alx.manpages@gmail.com \
--cc=alx@nginx.com \
--cc=git@vger.kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).