perf: drop redundant resp.Reset in worker loops

fasthttp resets the response at the top of every HostClient.Do, so
resetting it in the worker loop only repeats that work once per request.
This commit is contained in:
2026-08-10 00:10:27 +04:00
parent 01b5233167
commit e83e9346a3
-5
View File
@@ -94,7 +94,6 @@ func (s sarin) workerStatsWithDynamic(
) {
for range jobs {
req.Reset()
resp.Reset()
if err := requestGenerator(req); err != nil {
s.responses.Add(err.Error(), 0)
@@ -138,8 +137,6 @@ func (s sarin) workerStatsWithStatic(
}
for range jobs {
resp.Reset()
startTime := time.Now()
err := hostClientGenerator().DoTimeout(req, resp, s.timeout)
respDuration := time.Since(startTime)
@@ -165,7 +162,6 @@ func (s sarin) workerNoStatsWithDynamic(
) {
for range jobs {
req.Reset()
resp.Reset()
if err := requestGenerator(req); err != nil {
sendLog(runtimeLogLevelError, err.Error())
counter.Add(1)
@@ -201,7 +197,6 @@ func (s sarin) workerNoStatsWithStatic(
}
for range jobs {
resp.Reset()
startTime := time.Now()
err := hostClientGenerator().DoTimeout(req, resp, s.timeout)
if err == nil {