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
cluster: small performance optimisations #780
Commits on Aug 2, 2023
-
cluster: elide clones by moving keyspaces there and back
Keyspace strategies were cloned and allocated into a Vec, just for creating an iterator to references to them in order to construct a `ReplicaLocator`. It was done due to lifetime issues (in order to send references to another thread, they must be 'static). The problem is solved by sending keyspaces to another thread for constructing `ReplicaLocator` and then moving it back to the calling thread afterwards. Clones are elided. Hooray!
Configuration menu - View commit details
-
Copy full SHA for 638db21 - Browse repository at this point
Copy the full SHA 638db21View commit details -
cluster: elide clones at PeerEndpoint construction
By leveraging branched variable initialisation, cloning datacenters and racks is no longer necessary.
Configuration menu - View commit details
-
Copy full SHA for 94557a8 - Browse repository at this point
Copy the full SHA 94557a8View commit details -
cluster: elide clone in update_rack_count()
This one wasn't particularly hard.
Configuration menu - View commit details
-
Copy full SHA for 7f9d5e7 - Browse repository at this point
Copy the full SHA 7f9d5e7View commit details -
cluster: un-async get_working_connections()
There no reason why the method should be async.
Configuration menu - View commit details
-
Copy full SHA for 00d37b3 - Browse repository at this point
Copy the full SHA 00d37b3View commit details
Commits on Aug 3, 2023
-
cluster: prepare: refactor for clarity
There was a convoluted logic that can be easily expressed using itertools' `find_or_first()` iterator method.
Configuration menu - View commit details
-
Copy full SHA for e81b93b - Browse repository at this point
Copy the full SHA e81b93bView commit details
Commits on Aug 22, 2023
-
cluster: change get_working_connections() to iter variant
`get_working_connections()` not only allocated `Vec`s for all nodes, but it even cloned them to one big `Vec`. At least the latter could be avoided by returning an iterator over connections. The new replacement method, `iter_working_connections()`, was put on `ClusterData` instead of `Cluster`, because it borrows from `ClusterData`, so lifetime issues would be brought otherwise. The two uses of `get_working_connections()`, `Session::prepare()` and `Session::check_schema_agreement()`, were updated to use `iter_working_connections()`, and `get_working_connections()` was deleted as not needed anymore.
Configuration menu - View commit details
-
Copy full SHA for 610956b - Browse repository at this point
Copy the full SHA 610956bView commit details -
cluster: send_use_keyspace(): avoid Vec allocation
As `join_all()` accepts any `IntoIterator`, it accepts iterators in particular. Allocating a `Vec` is unnecessary.
Configuration menu - View commit details
-
Copy full SHA for 1bc5744 - Browse repository at this point
Copy the full SHA 1bc5744View commit details