[PR #157] [MERGED] feat: faster serialization #174

Closed
opened 2025-12-29 15:18:51 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/yusing/godoxy/pull/157
Author: @yusing
Created: 10/1/2025
Status: Merged
Merged: 10/2/2025
Merged by: @yusing

Base: mainHead: feat/faster-serialization


📝 Commits (5)

  • bd4a31f refactor: improve deserialization performance
  • 6a97d72 refactor(serialization): simplify string conversion logic in Convert function
  • 27f190c Merge branch 'main' into feat/faster-serialization
  • c2c22dc fix(serialization): default value lookup
  • 1322951 refactor: add comment about concurrency in RegisterDefaultValueFactory

📊 Changes

10 files changed (+325 additions, -220 deletions)

View changed files

📝 agent/go.mod (+1 -0)
📝 agent/go.sum (+2 -0)
📝 go.mod (+1 -0)
📝 go.sum (+2 -0)
📝 internal/dnsproviders/go.mod (+1 -0)
📝 internal/dnsproviders/go.sum (+2 -0)
📝 internal/logging/accesslog/fields.go (+1 -1)
📝 internal/serialization/serialization.go (+220 -170)
internal/serialization/serialization_benchmark_test.go (+95 -0)
📝 internal/serialization/serialization_test.go (+0 -49)

📄 Description

Improved serialization performance and fixed default values not being applied in some cases.


Note

Speeds up serialization with a reflection/type-info refactor using gointernals, adds benchmarks and test updates, and makes access log field validation optional; introduces the gointernals dependency.

  • Serialization (performance refactor):
    • Replace field extraction with cached typeInfo (hashed key lookup) and lazy pointer initialization.
    • Use github.com/yusing/gointernals helpers for pointer/map/slice init, numeric checks, and string/number conversions; broader numeric handling and direct SetZero usage.
    • Simplify dive, switch to reflect-based path access, improve unknown-field suggestions, and streamline map/slice assignment.
    • Add benchmarks in internal/serialization/serialization_benchmark_test.go; update tests to match new behavior.
  • Logging:
    • Make FieldConfig.Default validation optional (validate:"omitempty,oneof=keep drop redact").
  • Dependencies:
    • Add github.com/yusing/gointernals v0.1.16 (root, agent, dnsproviders).

Written by Cursor Bugbot for commit 1322951f26. This will update automatically on new commits. Configure here.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/yusing/godoxy/pull/157 **Author:** [@yusing](https://github.com/yusing) **Created:** 10/1/2025 **Status:** ✅ Merged **Merged:** 10/2/2025 **Merged by:** [@yusing](https://github.com/yusing) **Base:** `main` ← **Head:** `feat/faster-serialization` --- ### 📝 Commits (5) - [`bd4a31f`](https://github.com/yusing/godoxy/commit/bd4a31f817819b8b72c42e05a96345f155636028) refactor: improve deserialization performance - [`6a97d72`](https://github.com/yusing/godoxy/commit/6a97d72885359004f4f8eb75eb43cded5c5e829c) refactor(serialization): simplify string conversion logic in Convert function - [`27f190c`](https://github.com/yusing/godoxy/commit/27f190c3a234b14e3cee2539b01a2d5f69522c51) Merge branch 'main' into feat/faster-serialization - [`c2c22dc`](https://github.com/yusing/godoxy/commit/c2c22dca0bf23678ca53446a2f0a210d4303dd71) fix(serialization): default value lookup - [`1322951`](https://github.com/yusing/godoxy/commit/1322951f26929fb171137fd50f6b2e161d8e0c1d) refactor: add comment about concurrency in RegisterDefaultValueFactory ### 📊 Changes **10 files changed** (+325 additions, -220 deletions) <details> <summary>View changed files</summary> 📝 `agent/go.mod` (+1 -0) 📝 `agent/go.sum` (+2 -0) 📝 `go.mod` (+1 -0) 📝 `go.sum` (+2 -0) 📝 `internal/dnsproviders/go.mod` (+1 -0) 📝 `internal/dnsproviders/go.sum` (+2 -0) 📝 `internal/logging/accesslog/fields.go` (+1 -1) 📝 `internal/serialization/serialization.go` (+220 -170) ➕ `internal/serialization/serialization_benchmark_test.go` (+95 -0) 📝 `internal/serialization/serialization_test.go` (+0 -49) </details> ### 📄 Description Improved serialization performance and fixed default values not being applied in some cases. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Speeds up serialization with a reflection/type-info refactor using gointernals, adds benchmarks and test updates, and makes access log field validation optional; introduces the gointernals dependency. > > - **Serialization (performance refactor)**: > - Replace field extraction with cached `typeInfo` (hashed key lookup) and lazy pointer initialization. > - Use `github.com/yusing/gointernals` helpers for pointer/map/slice init, numeric checks, and string/number conversions; broader numeric handling and direct `SetZero` usage. > - Simplify `dive`, switch to reflect-based path access, improve unknown-field suggestions, and streamline map/slice assignment. > - Add benchmarks in `internal/serialization/serialization_benchmark_test.go`; update tests to match new behavior. > - **Logging**: > - Make `FieldConfig.Default` validation optional (`validate:"omitempty,oneof=keep drop redact"`). > - **Dependencies**: > - Add `github.com/yusing/gointernals v0.1.16` (root, agent, dnsproviders). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 1322951f26929fb171137fd50f6b2e161d8e0c1d. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 15:18:51 +01:00
adam closed this issue 2025-12-29 15:18:51 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/godoxy-yusing#174