Comparing Performance After Optimization in django-mariadb-vector
Since version v0.2.0, the ‘django-mariadb-vector‘ library includes several optimization options. Here are the results from performance tests.
Note: Performance was measured using 20,000 iterations (3 runs) in tests/measure\_performance.py, with randomly generated vectors of dimension 3072.
Benefits ‘orlson’ vs ‘json’
- Up to ~20× faster compared to the standard
jsonlibrary on generate vector data - Up to ~8× faster compared to the standard
jsonlibrary on response vector data
Benefits of ‘binary’ on response vector data
- Up to ~16× faster compared to the standard
jsonlibrary - About ~2× faster compared to
orjson
Testing output
Warming for 3 seconds
decode_binary start testing...
binary: 1.8913245666384075 [1.9641265999525785, 1.8629208999918774, 1.846926199970767]
decode_orjson_str start testing...
json_str: 3.804304266697727 [4.095871299970895, 3.7040354000637308, 3.6130061000585556]
decode_json_str start testing...
json_str: 30.897333099972457 [30.78853879997041, 31.119306599954143, 30.784153899992816]
* decode binary is fastest than json in 16.34 times
* decode binary is fastest than orjson in 2.01 times
* decode orjson is fastest than json in 8.12 times
encode_orjson_str start testing...
orjson_str: 2.32788303331472 [2.455615399987437, 2.2925777999917045, 2.235455899965018]
encode_json_str start testing...
json_str: 51.04346506666237 [50.961705199908465, 50.88195970002562, 51.28673030005302]
* encode orjson is fastest than json in 21.93 times
Reference
🔗 DEMO Django application of usage library ‘django-mariadb-vector’ (MariaDB Vector)
🔗 Django MariaDB Vector package on pypi - ‘django-mariadb-vector’
🔗 Repo library: https://github.com/lexxai/django-mariadb-vector
🔗 Repo Demo: https://github.com/lexxai/django-mariadb-vector-demo
