Litote / kmongo

[deprecated] KMongo - a Kotlin toolkit for Mongo
https://litote.org/kmongo/
Apache License 2.0
781 stars 74 forks source link

fix : perf issue with Class.forName with Kotlinx Datetime #416

Closed fhebuterne closed 1 year ago

fhebuterne commented 1 year ago

Hi,

Since kmongo 4.7.2, performance has been degraded by Class.forName with kotlinx datetime during our requests to DB.

We not using kotlinx datetime lib, so Class.forName is call each time.

By using AsyncProfiler on wall mode, we can see it :

perf_issue_01

perf_issue_02

For an hotfix for us, we added kotlinx datetime to fix issue in our side, waiting a fix on KMongo.

I have added a fix on this PR, by loading Class.forName only on first time.

Could you check it, please 🙏 ?

Sincerely, Fabien

zigzago commented 1 year ago

Thank you for the PR.