Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Improve performance of TransactionLog.add() #15111
Improve performance of
Code may be considered cleaner/simpler now, but the reason for this change is performance. When in a single transaction entries were changed, and then changed again (
In this gist, you can find benchmark that I used to make sure that this change improves performance. Here are the results:
As you can see, when there are 1000 or 10000 entries in a transaction, the performance after change is better and more stable.
…move() call. Code may be considered cleaner/simpler now, but the reason for this change is performance. When in a single transaction entries were changed, and then changed again (TransactionalMap.put() called on the same entry), the TransactionLog.add() method did a LinkedList.remove() call which has complexity O(n). The new implementation that uses LinkedHashMap instead of LinkedList+HashMap is up to 20% faster on 1000-entry transaction, and up to three times faster on 10000-entry transaction. On small transactions performance is the same.
Any chances of merging this rather simple pull request into Hazelcast 3.12.x? The performance difference is even more evident for transactions in which 100000 entries are being modified. And yes, we do have such large transaction in our project that uses Hazelcast.
mmedenjak left a comment •
Looks great, thank you for this improvement. I've added some minor comments that you can address or not, as you wish. I think we may backport this to 3.12.3 since it looks backwards compatible. So please cherry-pick this commit and send one more PR for the