Write to rotating ContentReWriter in transformer chain
authorbep <bjorn.erik.pedersen@gmail.com>
Tue, 17 Mar 2015 23:36:48 +0000 (00:36 +0100)
committerbep <bjorn.erik.pedersen@gmail.com>
Wed, 18 Mar 2015 16:05:54 +0000 (17:05 +0100)
commit98ee69bce207a4c2a7c2ffca2b3e7c0ccdd6e8c9
treeebfb45ab42cad8a14dc44f8bacb92b47cfd12b94
parent9688ed2585fcea732095baeb4006c5c96875447c
Write to rotating ContentReWriter in transformer chain

This commit adds the interface ContentReWriter in the tranformer chain.

This is backed by two pooled byte buffers, alternating between being the reader or the writer.

This keeps the performance characteristic of the old implementation, but in a thread safe way.

Fixes #911

Benchmark old vs new:

benchmark              old ns/op     new ns/op     delta
BenchmarkAbsURL        17614         17384         -1.31%
BenchmarkXMLAbsURL     9431          9248          -1.94%

benchmark              old allocs     new allocs     delta
BenchmarkAbsURL        24             28             +16.67%
BenchmarkXMLAbsURL     12             14             +16.67%

benchmark              old bytes     new bytes     delta
BenchmarkAbsURL        3295          3424          +3.92%
BenchmarkXMLAbsURL     1954          1987          +1.69%
transform/absurl.go
transform/absurlreplacer.go
transform/chain.go
transform/chain_test.go
transform/livereloadinject.go