[kvdb] Speed up find by header name_crc gate#380
Open
illustriousness wants to merge 1 commit intoarmink:masterfrom
Open
[kvdb] Speed up find by header name_crc gate#380illustriousness wants to merge 1 commit intoarmink:masterfrom
illustriousness wants to merge 1 commit intoarmink:masterfrom
Conversation
Contributor
illustriousness
commented
Nov 26, 2025
- 为 KV 头与 struct fdb_kv 补充 name_crc(name CRC32 低 16 位),创建时写入,读取时带出。
- find_kv 的遍历改为先读头部长度+name_crc,匹配才继续读 name/value 并比对字符串,不匹配直接跳过,减少无缓存扫描Flash 读。
- kv_iterator 支持可选 search_ctx,兼容未匹配时提前返回;缓存命中/打印/GC 等路径传 NULL 保持旧行为。
- 补充 <stdint.h> 头,确保类型声明完整。
- 对旧数据兼容:当头部 name_crc 为擦除态 0xFFFF 时仍继续匹配逻辑。
Contributor
Author
Owner
|
请问这部分优化有做一些对比测试吗?方不方便给出一个优化前后的具体数据呢? |
Contributor
Author
Contributor
Author
|
另外原本的工作流测试不完全 只测试了写入粒度为1的情况 而非遍历所有可能取值 |
Owner
|
看着 感觉提升不太大呢 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

