Marten Seemann
8c062ae604
use testing.B.Loop in all benchmark tests ( #5285 )
...
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -category=bloop -fix -test ./...
was used as a starting point.
2025-08-16 12:44:56 +02:00
Benjamin M. Schwartz
c7cf12703d
quicvarint: tolerate empty reads of the underlying io.Reader ( #5275 )
...
* Tolerate empty reads in `quicvarint.Read`
Currently, `quicvarint.Read` misinterprets an empty read (`n==0`)
as a single zero byte. While empty reads are "discouraged" in
the `io.Reader` interface, they do sometimes happen, especially
when using `io.Pipe()`.
This change tolerates empty reads, adds a corresponding unit test,
and also includes some additional test coverage related to empty
capsules
* minor test refactor
---------
Co-authored-by: Marten Seemann <martenseemann@gmail.com >
2025-08-05 08:05:52 +02:00
Marten Seemann
fa8ca045dd
quicvarint: extend benchmark to use quicvarint.Reader ( #5278 )
...
* quicvarint: extend benchmark to use quicvarint.Reader
* rename variable
2025-08-05 07:49:55 +02:00
Jannis Seemann
b94fc4d2d4
quicvarint: speed up parsing of 1, 2 and 4 byte varints ( #5229 )
2025-06-24 15:42:13 +02:00
Marten Seemann
267cca773b
switch from math/rand to math/rand/v2 ( #5045 )
...
* switch from math/rand to math/rand/v2
* switch away from golang.org/x/exp/rand
2025-04-19 09:01:22 +02:00
Marten Seemann
1d8f3f281a
ci: update golangci-lint to v2 ( #5007 )
2025-03-30 07:16:14 +02:00
Marten Seemann
4290638b55
quicvarint: refactor ifs into a switch statement ( #5012 )
...
No functional change expected.
2025-03-29 17:03:18 +01:00
Marten Seemann
4aee0c0acd
quicvarint: migrate tests away from Ginkgo ( #4662 )
2024-09-11 22:22:17 -07:00
Marten Seemann
e737d4a40e
wire: speed up parsing of headers with arbitrary length connection IDs ( #4618 )
...
This is significantly faster:
name old time/op new time/op delta
ArbitraryHeaderParsing/dest_8/_src_10-16 53.8ns ± 2% 27.4ns ± 2% -49.01% (p=0.008 n=5+5)
ArbitraryHeaderParsing/dest_20_/_src_20-16 61.6ns ± 1% 33.3ns ± 3% -46.00% (p=0.008 n=5+5)
ArbitraryHeaderParsing/dest_100_/_src_150-16 90.0ns ± 3% 54.8ns ± 5% -39.09% (p=0.008 n=5+5)
name old alloc/op new alloc/op delta
ArbitraryHeaderParsing/dest_8/_src_10-16 72.0B ± 0% 24.0B ± 0% -66.67% (p=0.008 n=5+5)
ArbitraryHeaderParsing/dest_20_/_src_20-16 96.0B ± 0% 48.0B ± 0% -50.00% (p=0.008 n=5+5)
ArbitraryHeaderParsing/dest_100_/_src_150-16 320B ± 0% 272B ± 0% -15.00% (p=0.008 n=5+5)
name old allocs/op new allocs/op delta
ArbitraryHeaderParsing/dest_8/_src_10-16 3.00 ± 0% 2.00 ± 0% -33.33% (p=0.008 n=5+5)
ArbitraryHeaderParsing/dest_20_/_src_20-16 3.00 ± 0% 2.00 ± 0% -33.33% (p=0.008 n=5+5)
ArbitraryHeaderParsing/dest_100_/_src_150-16 3.00 ± 0% 2.00 ± 0% -33.33% (p=0.008 n=5+5)
2024-08-03 16:50:42 -07:00
Marten Seemann
11111228cf
quicvarint: add function to parse a varint from a byte slice ( #4475 )
2024-05-03 04:58:18 -07:00
Marten Seemann
6325696fde
quicvarint: use int return value instead of internal protocol.ByteCount ( #4356 )
2024-03-19 14:56:55 -07:00
Marten Seemann
5aa2beb706
quicvarint: remove deprecated Write function ( #3781 )
2023-05-09 12:06:22 -07:00
Marten Seemann
04c3fd0756
deprecate quicvarint.Write in favor of quicvarint.Append ( #3690 )
2023-02-13 02:52:25 -08:00
Marten Seemann
58cedf7a4f
rename module, adjust import paths to quic-go/quic-go ( #3680 )
2023-01-21 19:53:57 -08:00
Marten Seemann
c24fbb094c
refactor header writing to append to a byte slice ( #3646 )
...
This avoids having to allocate a bytes.Buffer.
2023-01-17 01:56:06 -08:00
Marten Seemann
870fbe7ab0
migrate to Ginkgo v2
2022-10-11 16:38:44 +04:00
Marten Seemann
65dd82ad90
implement a quicvarint.Append method
2022-08-28 22:51:03 +03:00
Marten Seemann
9d5de12933
make it possible to parse a varint at the end of a reader ( #3428 )
...
An io.Reader can read into the buffer and return the io.EOF in the same
call. In fact, that's how the quic.Stream is implemented.
In that case, we shouldn't return an error from quicvarint.Read,
otherwise the caller won't be able to parse a varint sent just before a
stream was closed.
2022-05-26 10:52:50 -07:00
Randy Reddig
4a9bd794bf
quicvarint: export Min and Max ( #3253 )
2021-08-10 02:11:49 -07:00
Randy Reddig
346bd63a60
quicvarint: add Reader and Writer interfaces ( #3233 )
2021-08-05 10:49:17 -07:00
Marten Seemann
f9226887b4
rename ReadVarint / WriteVarInt / VarIntLen to Read / Write / Len
2021-01-02 00:15:07 +08:00
Marten Seemann
11c5045065
move varint encoding / decoding to a separate package
...
... which is not internal.
2021-01-01 11:46:45 +08:00