MongoDB python bindings an order of magnitude slower than java? MongoDB python bindings an order of magnitude slower than java? mongodb mongodb

MongoDB python bindings an order of magnitude slower than java?


Well looking at your post on Google Groups as well, here's my 2c:

  1. Python is slower than Java. Since Python is not typed, it's interpreter cannot do all the Java JIT "magic" and so it will always be slower at runtime.

  2. On the Google Groups thread it is stated that:

"The big surprise in the results is how the Python benchmark performance degrades when I insert shorter values. If anything, I would have expected the opposite. Comparatively, the Java numbers are essentially the same for long vs. short strings".

This can be misleading due to Mongo's asynchronous behaviour when it comes to writes. Make sure you set the same Write Concern when you fire those writes in both your Java and Python benchmarks (and preferably set it to SAFE_MODE). In other words, if you don't specifically set any Write Concern, make sure the driver's default value is the same in both Python and Java variants.