-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: replacing
DefaultHasher
(#1926)
Co-authored-by: Tushar Mathur <[email protected]>
- Loading branch information
1 parent
ad2fbad
commit 8b6db44
Showing
9 changed files
with
52 additions
and
13 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "tailcall-hasher" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
fxhash = "0.2.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use std::hash::Hasher; | ||
|
||
use fxhash::FxHasher; | ||
|
||
/// A hasher that uses the FxHash algorithm. Currently it's a dumb wrapper | ||
/// around `fxhash::FxHasher`. We could potentially add some custom logic here | ||
/// in the future. | ||
#[derive(Default)] | ||
pub struct TailcallHasher { | ||
hasher: FxHasher, | ||
} | ||
|
||
impl Hasher for TailcallHasher { | ||
fn finish(&self) -> u64 { | ||
self.hasher.finish() | ||
} | ||
|
||
fn write(&mut self, bytes: &[u8]) { | ||
self.hasher.write(bytes) | ||
} | ||
} |
8b6db44
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running 30s test @ http://localhost:8000/graphql
4 threads and 100 connections
422199 requests in 30.01s, 2.12GB read
Requests/sec: 14068.97
Transfer/sec: 72.21MB