RUBY-3299 Direct access to `mongocrypt_binary_t` for better decryption performance by jamis · Pull Request #2899 · mongodb/mongo-ruby-driver
This adds a benchmark for testing the performance of decrypting a document with a large number of encrypted fields (1500), and then changes the implementation so that it accesses the underlying fields of mongocrypt_binary_t directly, rather than indirectly.
The resulting performance improvements are marginal, but consistent:
with indirect mongocrypt_binary_t access:
thread_count=1; median ops/sec=44
thread_count=2; median ops/sec=48
thread_count=8; median ops/sec=78
thread_count=64; median ops/sec=327
with direct mongocrypt_binary_t access:
thread_count=1; median ops/sec=47
thread_count=2; median ops/sec=52
thread_count=8; median ops/sec=82
thread_count=64; median ops/sec=360