diff options
| author | acdenisSK <[email protected]> | 2017-12-27 18:29:34 +0100 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-12-27 18:33:29 +0100 |
| commit | 3a0c8908ce837f6fe64f865a1a7a9de63cbd237c (patch) | |
| tree | a8597bb4a7d49cfd614a85d3f2b5a95d3df9e055 /src/client | |
| parent | Update dependencies (diff) | |
| download | serenity-3a0c8908ce837f6fe64f865a1a7a9de63cbd237c.tar.xz serenity-3a0c8908ce837f6fe64f865a1a7a9de63cbd237c.zip | |
Improve performance of builders even further
By negating hashing altogether.
The increase is around 1000-ish nanoseconds saved.
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/context.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/client/context.rs b/src/client/context.rs index b15e172..a7bd903 100644 --- a/src/client/context.rs +++ b/src/client/context.rs @@ -10,7 +10,7 @@ use builder::EditProfile; #[cfg(feature = "builder")] use internal::prelude::*; #[cfg(feature = "builder")] -use std::collections::HashMap; +use builder::VecMap; #[cfg(all(feature = "builder", feature = "cache"))] use super::CACHE; #[cfg(feature = "builder")] @@ -85,7 +85,7 @@ impl Context { /// ``` #[cfg(feature = "builder")] pub fn edit_profile<F: FnOnce(EditProfile) -> EditProfile>(&self, f: F) -> Result<CurrentUser> { - let mut map = HashMap::with_capacity(2); + let mut map = VecMap::with_capacity(2); feature_cache! { { @@ -107,7 +107,7 @@ impl Context { } } - let edited = utils::hashmap_to_json_map(f(EditProfile(map)).0); + let edited = utils::vecmap_to_json_map(f(EditProfile(map)).0); http::edit_profile(&edited) } |