I am working on a benchmark (Linkbench) for MongoDB. When I run the same workload for MongoDB 4.2.1 and MySQL 5.7.28 I see ~2.5X more CPU time in the Linkbench client for MongoDB than for the MySQL client. The client accounts for about 1/3 of total CPU time on the benchmark so my hope is that this can be reduced. The client includes generic code, per-DBMS code (MongoDB, MySQL) and code from the per-DBMS driver.
Most of the overhead is from BSON decode & encode functions. I will try using a codec next but reducing CPU overhead in the Java driver will still be useful for clients that don't use a code.
I attached CPU profiler output from VisualVM. Unfortunately the tool must be used to explore it. I have taken screenshots from the profiler tool but they have been hard to read. I can provide screenshots if they might help. But exploring via VisualVM is the best bet.