-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speed up bond repository update and remove some raw types #7082
Speed up bond repository update and remove some raw types #7082
Commits on Mar 8, 2024
-
Cleanup: replace putIfAbsent-then-get with computeIfAbsent
Use the simpler & slightly more efficient 'Map::computeIfAbsent' method in place of the common pattern: map.putIfAbsent(key, newValue()); V value = map.get(); (Clean up BondRepository + some cases missed from BurningManService.)
Configuration menu - View commit details
-
Copy full SHA for 314e976 - Browse repository at this point
Copy the full SHA 314e976View commit details -
Generify Bond raw types & rename BondRepository type params
Replace all raw uses of 'Bond<T extends BondedAsset>', mostly with wildcards (that is, 'Bond<?>'), to prevent compiler/IDE warnings. Also rename the 'T extends Bond<R>' & 'R extend BondedAsset' type params of 'BondRepository<..>' to 'B' & 'T' respectively, as this is a little less confusing.
Configuration menu - View commit details
-
Copy full SHA for e1a8424 - Browse repository at this point
Copy the full SHA e1a8424View commit details -
Generify remaining raw types used by the DAO packages
Fix raw usage of the following types, all of which (apart from Comparator) touch the DAO packages somewhere: Comparable, Comparator, GetStateHashesResponse, NewStateHashMessage, RequestStateHashesHandler, PersistenceManager (Also replace 'Integer.valueOf' with the non-boxing but otherwise identical method 'Integer.parseInt', in the class 'TxOutputKey'.)
Configuration menu - View commit details
-
Copy full SHA for c94fa98 - Browse repository at this point
Copy the full SHA c94fa98View commit details
Commits on Mar 9, 2024
-
Fix broken PreferencesTest mocks (revealed by strict Mockito stubbing)
Fix the broken stubbing of 'PersistenceManager', which had gone stale as a result of the conversion of 'Preferences' to asynchronous persistence in commit 3f4d6e6 (2020/10/12). This caused the assertions in the 'readPersisted' continuation blocks of 3 of the 4 tests not to be reached. Fix by stubbing the async 'persistenceManager::readPersisted' method with a callback, instead of stubbing 'getPersisted'. NOTE: Alternatively, we could add a testing-only 'readPersistedSync' method to 'Preferences' for consistency, as this is how the other broken (failing) tests resulting from 3f4d6e6 were fixed (in commit 68583d8).
Configuration menu - View commit details
-
Copy full SHA for 7d2e050 - Browse repository at this point
Copy the full SHA 7d2e050View commit details -
Add debug perf logging to BondRepository.update()
This is in anticipation of speedups we wish to make, as JProfiler reveals it to be a hotspot during new block arrivals (which are tricky to profile, as they occur at random).
Configuration menu - View commit details
-
Copy full SHA for 0a1df44 - Browse repository at this point
Copy the full SHA 0a1df44View commit details
Commits on Apr 19, 2024
-
Fix cubic time bug in BondedRolesRepository.update()
Alleviate a cubic time bug during the update of the bonded roles repository, reducing it to quadratic running time. On Mainnet, this gives a roughly ten-fold speedup and should allow better scaling in the event that many new bonded roles are added. Replace calls to 'BondedRolesRepository.findBondedAssetByHash' with a lookup into a lazily initialised map of bonded assets (Roles) by hash (reset at the start of each call to 'BondRepository.update()' to prevent stale caching). This avoids rescanning the roles list for every pair of roles and lockup tx outputs, thus reducing the number of steps (to highest order) from: #roles * #roles * #lockup-tx-outputs to: #roles * #lockup-tx-outputs (The logs show 2 or 3 calls to 'BondedRepository.update()' every time a new block arrives, and while this was only taking around a second or so on Mainnet, it could potentially grow to something problematic with cubic scaling in the number of bonded roles.)
Configuration menu - View commit details
-
Copy full SHA for 3a97953 - Browse repository at this point
Copy the full SHA 3a97953View commit details