FAQ
I'm interested in caching common values of HTTP headers in order to reduce
memory allocations per HTTP txn.

I'd like the textproto object used by net/http to persist across
transactions, in the same way that pp objects persist inside of the fmt
package across calls to Printf. Like that, the value cache(s) can be
per-goroutine (no locking) but reused once it is warmed up, by the next
transaction to come in (which is in a different goroutine).

It feels like I'm having to choose between making fmt.cache public (right,
like Rob's ever going to agree to that!) or copying fmt.cache into net/http
(right, like Russ and Brad are ever going to agree to that!)

If this was my own code, I'd have already copied it and never looked back.
But in the standard library, a decision to copy like this is a lot more
controversial it seems to me.

Thoughts?
-jeff

Search Discussions

  • David Symonds at Nov 16, 2012 at 12:11 pm
    I don't think copying fmt.cache into net/http would be all that
    controversial if it made a significant difference. Russ and Brad are
    pretty easy going about such things if it helps performance.


    Dave.
  • Dave Cheney at Nov 16, 2012 at 12:21 pm
    I have a private branch which implements two copies of the fmt cache, as
    the current impl uses interface{}. I'd recommend copying the cache and
    adjusting the type it caches.
    On 16 Nov 2012 23:11, "David Symonds" wrote:

    I don't think copying fmt.cache into net/http would be all that
    controversial if it made a significant difference. Russ and Brad are
    pretty easy going about such things if it helps performance.


    Dave.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedNov 16, '12 at 11:09a
activeNov 16, '12 at 12:21p
posts3
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase