netty5/microbench
Linas Medžiūnas abdcf102da Efficient BytBuf search algorithms (#9914) (#9955)
Motivation:

We have found out that ByteBufUtil.indexOf can be inefficient for substring search on
ByteBuf, both in terms of algorithm complexity (worst case O(needle.readableBytes *
haystack.readableBytes)), and in constant factor (esp. on Composite buffers).
With implementation of more performant search algorithms we have seen improvements on
the order of magnitude.

Modifications:

This change introduces three search algorithms:
1. Knuth Morris Pratt - classical textbook algorithm, a good default choice.
2. Bit mask based algorithm - stable performance on any input, but limited to maximum
search substring (the needle) length of 64 bytes.
3. Aho–Corasick - worse performance and higher memory consumption than [1] and [2], but
it supports multiple substring (the needles) search simultaneously, by inspecting every
byte of the haystack only once.

Each algorithm processes every byte of underlying buffer only once, they are implemented
as ByteProcessor.

Result:

Efficient search algorithms with linear time complexity available in Netty (I will share
benchmark results in a comment on a PR).
2020-04-15 10:26:53 +02:00
..
src/main Efficient BytBuf search algorithms (#9914) (#9955) 2020-04-15 10:26:53 +02:00
pom.xml Update to latest JMH version (#9787) 2019-11-19 11:28:36 +01:00
README.md Change the netty.io homepage scheme(http -> https) (#9344) 2019-07-09 21:10:14 +02:00

Microbenchmark tests

See our wiki page.