Skip to content

Perf#13

Merged
eustrainLee merged 5 commits intoeveroute:mainfrom
eustrainLee:perf
Feb 24, 2026
Merged

Perf#13
eustrainLee merged 5 commits intoeveroute:mainfrom
eustrainLee:perf

Conversation

@eustrainLee
Copy link

@eustrainLee eustrainLee commented Feb 24, 2026

以下为全部变更

  1. 添加 SerializeTo,用于在部分情况下替换 Serialize 函数,以避免不必要的内存分配。
  2. 将 Request 类型从传指针改为传值,以避免每次请求都要分配一个 Request 对象,而这个对象并不大,只需要复制即可,不过如果服用此对象需要重置它。
  3. 提供 NewConntrackCreateRequest 和 NewConntrackUpdateRequest,以及 Execute 方法,以复用 Request 对象和控制是否需要响应 ACK
  4. 优化 toNlData 函数,不再分配不必要的切片
  5. 修复 toNlData 函数,在传入一个 16 字节的 IPv4 地址时不再序列化一个 IPv6 地址到 buffer 中。
  6. 在反序列化过程中,移除了没有必要使用的 bytes.Reader 和 binary.Read,以提升效率和减少内存开销,尤其是 binary.Read 的实现很差劲。
  7. 将 []byte 改为 [16]byte,以避免额外的堆内存分配,并添加了字段 HasLabels 和 HasLabelsMask,以在不引入 mo.Option 的情况下标识是否有值。
  8. 在函数 ConntrackTableList 中一次性分配内存,在 ConntrackTableListStream 中需要传递 allocator 用于分配内存。

@eustrainLee eustrainLee merged commit 2b8b85e into everoute:main Feb 24, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant