Remove lots of redundant string allocations
This commit is contained in:
parent
fe744c856f
commit
dbe8c2ce19
7 changed files with 87 additions and 95 deletions
|
@ -217,7 +217,7 @@ impl Database {
|
|||
}
|
||||
|
||||
pub async fn watch(&self, user_id: &UserId, device_id: &DeviceId) {
|
||||
let userid_bytes = user_id.to_string().as_bytes().to_vec();
|
||||
let userid_bytes = user_id.as_bytes().to_vec();
|
||||
let mut userid_prefix = userid_bytes.clone();
|
||||
userid_prefix.push(0xff);
|
||||
|
||||
|
@ -241,7 +241,7 @@ impl Database {
|
|||
|
||||
// Events for rooms we are in
|
||||
for room_id in self.rooms.rooms_joined(user_id).filter_map(|r| r.ok()) {
|
||||
let roomid_bytes = room_id.to_string().as_bytes().to_vec();
|
||||
let roomid_bytes = room_id.as_bytes().to_vec();
|
||||
let mut roomid_prefix = roomid_bytes.clone();
|
||||
roomid_prefix.push(0xff);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue