netty5/codec-socks/src
Nick Hill 583d838f7c Optimize AbstractByteBuf.getCharSequence() in US_ASCII case (#8392)
* Optimize AbstractByteBuf.getCharSequence() in US_ASCII case

Motivation:

Inspired by https://github.com/netty/netty/pull/8388, I noticed this
simple optimization to avoid char[] allocation (also suggested in a TODO
here).

Modifications:

Return an AsciiString from AbstractByteBuf.getCharSequence() if
requested charset is US_ASCII or ISO_8859_1 (latter thanks to
@Scottmitch's suggestion). Also tweak unit tests not to require Strings
and include a new benchmark to demonstrate the speedup.

Result:

Speed-up of AbstractByteBuf.getCharSequence() in ascii and iso 8859/1
cases
2018-10-26 15:32:38 -07:00
..
main/java/io/netty/handler/codec Fix incorrectly encoded empty SOCKS5 address (#8292) 2018-09-18 14:20:28 -07:00
test/java/io/netty/handler/codec Optimize AbstractByteBuf.getCharSequence() in US_ASCII case (#8392) 2018-10-26 15:32:38 -07:00