refactor(misc): enhance performance on bytes pool, entrypoint, access log and route context handling

- Introduced benchmark tests for Entrypoint and ReverseProxy to evaluate performance.
- Updated Entrypoint's ServeHTTP method to improve route context management.
- Added new test file for entrypoint benchmarks and refined existing tests for route handling.
This commit is contained in:
yusing
2025-09-14 00:03:27 +08:00
parent e0d25e475c
commit f31b1b5ed3
11 changed files with 623 additions and 33 deletions

View File

@@ -76,7 +76,7 @@ const (
errBurst = 5
)
var lineBufPool = synk.GetBytesPool()
var lineBufPool = synk.GetBytesPoolWithUniqueMemory()
func NewAccessLogger(parent task.Parent, cfg AnyConfig) (*AccessLogger, error) {
io, err := cfg.IO()

View File

@@ -66,7 +66,7 @@ type lineInfo struct {
Size int64 // Size of this line
}
var rotateBytePool = synk.GetBytesPool()
var rotateBytePool = synk.GetBytesPoolWithUniqueMemory()
// rotateLogFile rotates the log file based on the retention policy.
// It returns the result of the rotation and an error if any.