mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2026-01-31 15:53:10 +08:00
Prev, `FullResponseString()`, `BodyString()`, and `HeadersString()` were called multiple times per HTTP response iteration, each call allocating a new string copy of the response data. For a 10MB response, this resulted in ~60MB of redundant string allocs/response (6 calls x 10MB). Cache the string representations once per `Fill()` cycle and reuse them throughout the response processing loop. This reduces allocs from 6 to 3 per response, cutting memory usage by ~50% for response string handling. Profiling showed these functions accounting for ~89% of heap allocs (5.7GB out of 6.17GB) during large scans. Signed-off-by: Dwi Siswanto <git@dw1.io>