Re: [vim/vim] ins_compl_add(): use a hashtab for the duplicate check (PR #20926)

h_east (Vim Github Repository) <[email protected]> Mon, 03 Aug 2026 21:27:15 -0700
Newsgroups gmane.editors.vim.devel
Message-ID <vim/vim/pull/20926/[email protected]>

----==_mimepart_6a716a2387541_b8118055529a
Content-Type: text/plain; charset="UTF-8"

h-east left a comment (vim/vim#20926)

### The technical points look addressed

The hashtab is now consulted before the scan for "nearest" too, the per-string
count removes the divergence, and each entry owning its string also drops the
reliance on `cp_str.string` never being reallocated.  The timeout test scales
the word count instead of just raising the bound.  Good.

### The hash_lookup() result is carried too far

`str_hi` is obtained near the top of `ins_compl_add()` and used at the bottom
in `compl_strings_add()`.  It is correct today, `ins_compl_del_pum()` frees no
match, but a `hashitem_T` is only valid until the next change to the hashtab
and nothing in the code says so.  A comment at the lookup, that no match may
be freed before the matching add, would make that visible.

### Co-Authored-By: is still missing

I raised this in the previous review and it was not addressed.  None of the
four commits carries the trailer.

`AGENTS.md` in the repository root is explicit:

> - **`Co-Authored-By:` is allowed** and is the accepted way to
>   acknowledge AI assistance transparently.

If any part of this patch was produced with AI assistance, the commits must
say so.  This is not a formality: it is how this repository records
authorship, and it is not something a reviewer can establish from the outside.
Please amend the commits.

If no AI was involved at any point, say so plainly and I will drop the point.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/vim/vim/pull/20926#issuecomment-5174603557
You are receiving this because you are subscribed to this thread.

Message ID: <vim/vim/pull/20926/[email protected]>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/vim/vim/pull/20926/c5174603557%40github.com.

----==_mimepart_6a716a2387541_b8118055529a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div style=3D"display: flex; flex-wrap: wrap; white-space: pre-wrap; align-=
items: center; "><img height=3D"20" width=3D"20" style=3D"border-radius:50%=
; margin-right: 4px;" decoding=3D"async" src=3D"https://avatars.githubuserc=
ontent.com/u/518808" /><strong>h-east</strong> left a comment <a href=3D"ht=
tps://github.com/vim/vim/pull/20926#issuecomment-5174603557">(vim/vim#20926=
)</a></div>
<h3 dir=3D"auto">The technical points look addressed</h3>
<p dir=3D"auto">The hashtab is now consulted before the scan for "nearest" =
too, the per-string<br>
count removes the divergence, and each entry owning its string also drops t=
he<br>
reliance on <code class=3D"notranslate">cp_str.string</code> never being re=
allocated.  The timeout test scales<br>
the word count instead of just raising the bound.  Good.</p>
<h3 dir=3D"auto">The hash_lookup() result is carried too far</h3>
<p dir=3D"auto"><code class=3D"notranslate">str_hi</code> is obtained near =
the top of <code class=3D"notranslate">ins_compl_add()</code> and used at t=
he bottom<br>
in <code class=3D"notranslate">compl_strings_add()</code>.  It is correct t=
oday, <code class=3D"notranslate">ins_compl_del_pum()</code> frees no<br>
match, but a <code class=3D"notranslate">hashitem_T</code> is only valid un=
til the next change to the hashtab<br>
and nothing in the code says so.  A comment at the lookup, that no match ma=
y<br>
be freed before the matching add, would make that visible.</p>
<h3 dir=3D"auto">Co-Authored-By: is still missing</h3>
<p dir=3D"auto">I raised this in the previous review and it was not address=
ed.  None of the<br>
four commits carries the trailer.</p>
<p dir=3D"auto"><code class=3D"notranslate">AGENTS.md</code> in the reposit=
ory root is explicit:</p>
<blockquote>
<ul dir=3D"auto">
<li><strong><code class=3D"notranslate">Co-Authored-By:</code> is allowed</=
strong> and is the accepted way to<br>
acknowledge AI assistance transparently.</li>
</ul>
</blockquote>
<p dir=3D"auto">If any part of this patch was produced with AI assistance, =
the commits must<br>
say so.  This is not a formality: it is how this repository records<br>
authorship, and it is not something a reviewer can establish from the outsi=
de.<br>
Please amend the commits.</p>
<p dir=3D"auto">If no AI was involved at any point, say so plainly and I wi=
ll drop the point.</p>

<p style=3D"font-size:small;-webkit-text-size-adjust:none;color:#666;">&mda=
sh;<br />Reply to this email directly, <a href=3D"https://github.com/vim/vi=
m/pull/20926#issuecomment-5174603557">view it on GitHub</a>, or <a href=3D"=
https://github.com/notifications/unsubscribe-auth/ACY5DGF76UEHGENUEF7K5SL5I=
FQ2HAVCNFSNUABEKJSXA33TNF2G64TZHM2DAOJZG42DQMR3JFZXG5LFHM2TANBWHE3DCNBSGSQX=
MAQ">unsubscribe</a>.<br />Triage notifications, keep track of coding agent=
 tasks and review pull requests on the go with GitHub Mobile for <a href=3D=
"https://github.com/notifications/mobile/ios/ACY5DGHBRGTPJUZRIDJCDCT5IFQ2HA=
5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMJXGQ3DAMZVGU32M4TFM=
FZW63VKON2WE43DOJUWEZLEUVSXMZLOOSVGM33PORSXEX3JN5ZQ">iOS</a> and <a href=3D=
"https://github.com/notifications/mobile/android/ACY5DGHNIMBWDORGWHZO2L35IF=
Q2HA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMJXGQ3DAMZVGU32M=
4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSXGM33PORSXEX3BNZSHE33JMQ">Android</a>.=
 Download it today!
<br />You are receiving this because you are subscribed to this thread.<img=
 src=3D"https://github.com/notifications/beacon/ACY5DGEYNGD7ZNLLZHX2S3T5IFQ=
2HBFCNFSM6AAAAAC4X5MRFKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3=
TUL5UWJTYAAAAACNDOF4S2M4TFMFZW63VKON2WE43DOJUWEZLE.gif" height=3D"1" width=
=3D"1" alt=3D"" /><span style=3D"color: transparent; font-size: 0; display:=
 none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: =
0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span>&lt;vim/vi=
m/pull/20926/c5174603557</span><span>@</span><span>github</span><span>.</sp=
an><span>com&gt;</span></span></p>

<script type=3D"application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/vim/vim/pull/20926#issuecomment-5174603557",
"url": "https://github.com/vim/vim/pull/20926#issuecomment-5174603557",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>

<p></p>

-- <br />
-- <br />
You received this message from the &quot;vim_dev&quot; maillist.<br />
Do not top-post! Type your reply below the text you are replying to.<br />
For more information, visit <a href=3D"http://www.vim.org/maillist.php">htt=
p://www.vim.org/maillist.php</a><br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;vim_dev&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">vim_dev+uns=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
vim_dev/vim/vim/pull/20926/c5174603557%40github.com?utm_medium=3Demail&utm_=
source=3Dfooter">https://groups.google.com/d/msgid/vim_dev/vim/vim/pull/209=
26/c5174603557%40github.com</a>.<br />

----==_mimepart_6a716a2387541_b8118055529a--