Skip to content

Commit d9cf649

Browse files
committed
Add comments.
JAVA-5816
1 parent 3980457 commit d9cf649

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

driver-core/src/main/com/mongodb/internal/connection/ByteBufferBsonOutput.java

+2
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,8 @@ private static int writeOnArrayAscii(final String str,
451451
final boolean checkNullTermination) {
452452
int pos = arrayPosition;
453453
int sp = 0;
454+
// Fast common path: This tight loop is JIT-friendly (simple, no calls, few branches),
455+
// It might be unrolled for performance.
454456
for (; sp < str.length(); sp++, pos++) {
455457
char c = str.charAt(sp);
456458
if (checkNullTermination && c == 0) {

0 commit comments

Comments
 (0)