mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-20 23:41:23 +02:00
perf(pool): split bytes pool into tiered sized and unsized pools
- Remove BytesPoolWithMemory; split into UnsizedBytesPool and 11-tier SizedBytesPool - Track buffer capacities with xsync Map to prevent capacity leaks - Improve buffer reuse: split large buffers and put remainders back in pool - Optimize small buffers to use unsized pool - Expand test coverage and benchmarks for various allocation sizes
This commit is contained in:
@@ -18,13 +18,13 @@ type modifyHTML struct {
|
||||
Target string // css selector
|
||||
HTML string // html to inject
|
||||
Replace bool // replace the target element with the new html instead of appending it
|
||||
bytesPool *synk.BytesPool
|
||||
bytesPool synk.UnsizedBytesPool
|
||||
}
|
||||
|
||||
var ModifyHTML = NewMiddleware[modifyHTML]()
|
||||
|
||||
func (m *modifyHTML) setup() {
|
||||
m.bytesPool = synk.GetBytesPool()
|
||||
m.bytesPool = synk.GetUnsizedBytesPool()
|
||||
}
|
||||
|
||||
func (m *modifyHTML) before(_ http.ResponseWriter, req *http.Request) bool {
|
||||
|
||||
Reference in New Issue
Block a user