MongoDB's Java team achieved 20-90% throughput improvements by profiling and optimizing the driver's hot paths. Key techniques included caching BSON array indexes as flat byte arrays, leveraging JVM intrinsics for byte order operations, using SWAR for null-terminator detection, eliminating redundant bounds checks, reducing

19m read time From foojay.io
Post cover image
Table of contents
Getting the metrics rightHow we measured performance2. Java Virtual Machine (JVM) intrinsics3. Check and check again4. BSON null terminator detection with SWAR5. Avoiding redundant copies and allocations6. String Encoding, removing method indirection and redundant checksLessons learned

Sort: