snowflake/common
David Fifield 839d221883 Take ownership of buffer in QueuePacketConn QueueIncoming/WriteTo.
This design is easier to misuse, because it allows the caller to modify
the contents of the slice after queueing it, but it avoids an extra
allocation + memmove per incoming packet.

Before:
	$ go test -bench='Benchmark(QueueIncoming|WriteTo)' -benchtime=2s -benchmem
	BenchmarkQueueIncoming-4         7001494               342.4 ns/op          1024 B/op          2 allocs/op
	BenchmarkWriteTo-4               3777459               627 ns/op            1024 B/op          2 allocs/op
After:
	$ go test -bench=BenchmarkWriteTo -benchtime 2s -benchmem
	BenchmarkQueueIncoming-4        13361600               170.1 ns/op           512 B/op          1 allocs/op
	BenchmarkWriteTo-4               6702324               373 ns/op             512 B/op          1 allocs/op

Despite the benchmark results, the change in QueueIncoming turns out not
to have an effect in practice. It appears that the compiler had already
been optimizing out the allocation and copy in QueueIncoming.
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40187

The WriteTo change, on the other hand, in practice reduces the frequency
of garbage collection.
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40199
2022-12-08 08:03:54 -07:00
..
amp format using go-1.19 2022-10-09 21:15:50 +02:00
bridgefingerprint Represent Bridge Fingerprint As String 2022-06-16 14:06:58 +01:00
encapsulation Benchmark for encapsulation.ReadData. 2022-11-16 13:48:34 -07:00
event change bandwidth type from int to int64 to prevent overflow 2022-11-21 10:33:21 -05:00
ipsetsink Use truncated hash instead crc64 for counted hash 2022-06-16 15:00:12 +01:00
messages format using go-1.19 2022-10-09 21:15:50 +02:00
namematcher Update Relay Pattern format to include dollar sign 2022-06-16 14:06:58 +01:00
nat Wrap client NAT log 2022-05-31 08:52:23 -07:00
safelog change regexes for ipv6 addresses to catch url-encoded addresses 2022-11-28 15:56:35 -05:00
task Wait some time before displaying the proxy usage log 2022-05-25 11:01:01 -04:00
turbotunnel Take ownership of buffer in QueuePacketConn QueueIncoming/WriteTo. 2022-12-08 08:03:54 -07:00
util Bump version of pion/sdp 2021-01-25 10:28:17 -05:00
utls Refactor utls roundtripper_test to deduplicate 2022-11-29 15:41:49 +00:00
version Bump version to v2.4.1 2022-12-01 11:38:22 -05:00
websocketconn Benchmark websocket.Conn Upgrade creation. 2022-11-16 13:48:34 -07:00