Skip to content

Conversation

@moshegood
Copy link

To reduce memory and CPU consumption, many libraries that implement Write also implement WriteString.
We should do the same here, as the default http server supports WriteString.

@moshegood moshegood force-pushed the support.StringWriter branch from 99bcd99 to 1ac35d1 Compare May 5, 2022 16:06
@lucacome lucacome requested a review from Copilot March 15, 2025 01:53
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces support for the io.StringWriter interface in the metrics tracker to reduce memory and CPU consumption. The changes include adding a WriteString method to metricsTracker and updating the wrappedResponseWriter function to include io.StringWriter in its returned interface combinations.

Comments suppressed due to low confidence (2)

nethttp/metrics-tracker.go:27

  • Please add tests for the new WriteString method to verify that size tracking and error propagation work as expected.
func (w *metricsTracker) WriteString(s string) (int, error) {

nethttp/metrics-tracker.go:50

  • Ensure that all branches in wrappedResponseWriter supporting io.StringWriter are covered by tests to validate the correct interface implementations.
io.StringWriter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant