2
0
mirror of https://github.com/soheilhy/cmux.git synced 2024-11-13 04:56:33 +08:00
Commit Graph

5 Commits

Author SHA1 Message Date
Tamir Duberstein
9421819d79
Add locking to patricia tree
Fixes race conditions in matchers. Impact on benchmarks:

name               old time/op    new time/op    delta
CMuxConnHTTP1-4       664ns ±19%     849ns ± 6%  +27.91%         (p=0.000 n=9+10)
CMuxConnHTTP2-4       745ns ±16%     699ns ± 9%     ~            (p=0.075 n=9+10)
CMuxConnHTTP1n2-4     930ns ±28%    1079ns ± 4%  +16.00%         (p=0.022 n=10+9)
CMuxConnHTTP2n1-4    1.18µs ±52%    0.98µs ±13%     ~           (p=1.000 n=10+10)

name               old alloc/op   new alloc/op   delta
CMuxConnHTTP1-4        256B ± 0%      256B ± 0%     ~     (all samples are equal)
CMuxConnHTTP2-4        288B ± 0%      288B ± 0%     ~     (all samples are equal)
CMuxConnHTTP1n2-4      288B ± 0%      288B ± 0%     ~     (all samples are equal)
CMuxConnHTTP2n1-4      288B ± 0%      288B ± 0%     ~     (all samples are equal)

name               old allocs/op  new allocs/op  delta
CMuxConnHTTP1-4        3.00 ± 0%      3.00 ± 0%     ~     (all samples are equal)
CMuxConnHTTP2-4        4.00 ± 0%      4.00 ± 0%     ~     (all samples are equal)
CMuxConnHTTP1n2-4      4.00 ± 0%      4.00 ± 0%     ~     (all samples are equal)
CMuxConnHTTP2n1-4      4.00 ± 0%      4.00 ± 0%     ~     (all samples are equal)
2016-07-12 12:32:15 -04:00
Soheil Hassas Yeganeh
cd9b7d74b9 Add copyright notice headers on all Go files.
As per http://www.apache.org/legal/src-headers.html#headers

Fixes #28
2016-07-09 13:56:02 -04:00
Soheil Hassas Yeganeh
703b087a39 Optimize Patricia tree
Remove all the extra allocations in the Patricia tree.

O(1) allocation for Patricia and  ~10% improvement for HTTP1 matching.

benchmark                      old ns/op     new ns/op     delta
BenchmarkCMuxConnHTTP1-4       908           782           -13.88%
BenchmarkCMuxConnHTTP2-4       835           818           -2.04%
BenchmarkCMuxConnHTTP1n2-4     1074          1033          -3.82%
BenchmarkCMuxConnHTTP2n1-4     1010          901           -10.79%

benchmark                      old allocs     new allocs     delta
BenchmarkCMuxConnHTTP1-4       5              3              -40.00%
BenchmarkCMuxConnHTTP2-4       4              4              +0.00%
BenchmarkCMuxConnHTTP1n2-4     6              4              -33.33%
BenchmarkCMuxConnHTTP2n1-4     6              4              -33.33%

benchmark                      old bytes     new bytes     delta
BenchmarkCMuxConnHTTP1-4       276           272           -1.45%
BenchmarkCMuxConnHTTP2-4       304           304           +0.00%
BenchmarkCMuxConnHTTP1n2-4     306           304           -0.65%
BenchmarkCMuxConnHTTP2n1-4     308           304           -1.30%
2016-05-03 22:28:32 -04:00
Tamir Duberstein
6c298ce7b1 Simplify formatting in patricia.go
`gofmt -s -w .`
2016-02-21 10:41:14 -05:00
Soheil Hassas Yeganeh
754f5b897d Initial commit 2015-07-29 13:49:26 -04:00