-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: 2.11.3
-
Component/s: BSON
-
None
-
Java Drivers
-
None
-
None
-
None
-
None
-
None
-
None
Currently ByteBufferBsonInput::readCString relies on an suboptimal byte per byte search for string termination: in Netty contains a SWAR indexOf method which could be (re)used to speed this operation, leveraging different concrete implementation based on the different ByteBuf concrete classes (see https://github.com/netty/netty/pull/10737.).
This will both save megamorphic single byte operations, including bound checks, accessibility checks, etc etc and reducing the number of branches (and misses, by consequence).