-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
83 changed files
with
2,347 additions
and
232 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use criterion::Criterion; | ||
use hyper::Method; | ||
use serde_json::Value; | ||
use tailcall::cli::runtime::NativeHttp; | ||
use tailcall::core::generator::{from_json, ConfigGenerationRequest}; | ||
use tailcall::core::HttpIO; | ||
|
||
pub fn benchmark_from_json_method(c: &mut Criterion) { | ||
let tokio_runtime = tokio::runtime::Runtime::new().unwrap(); | ||
|
||
let native_http = NativeHttp::init(&Default::default(), &Default::default()); | ||
let request_url = String::from("http://jsonplaceholder.typicode.com/users"); | ||
|
||
let mut reqs = Vec::with_capacity(1); | ||
tokio_runtime.block_on(async { | ||
let request = reqwest::Request::new(Method::GET, request_url.parse().unwrap()); | ||
let result = native_http.execute(request).await.unwrap(); | ||
let body: Value = serde_json::from_slice(&result.body).unwrap(); | ||
reqs.push(body); | ||
}); | ||
|
||
let cfg_gen_reqs = [ConfigGenerationRequest::new( | ||
request_url.parse().unwrap(), | ||
reqs[0].clone(), | ||
)]; | ||
|
||
c.bench_function("from_json_bench", |b| { | ||
b.iter(|| { | ||
let _ = from_json(&cfg_gen_reqs, "Query"); | ||
}); | ||
}); | ||
} |
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
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
Oops, something went wrong.
b5a499a
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
453344 requests in 30.01s, 2.27GB read
Requests/sec: 15108.09
Transfer/sec: 77.54MB