Skip to content

Commit

Permalink
Some better performance by avoiding copies
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiPolo committed Feb 5, 2020
1 parent 22fe5d9 commit b746eeb
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 98 deletions.
81 changes: 41 additions & 40 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ http = "*"
shellexpand = "1.0"
itertools = "0.8"
comfy-table = "0.0.6"
lazy_static = "*"

[patch.crates-io]
openapiv3 = { git = "https://github.com/glademiller/openapiv3", branch = "master" }


[profile.dev]
debug=0
debug = 0

[profile.release]
opt-level = 3
Expand Down
12 changes: 6 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//mod string_validator;
//#![deny(clippy::all)]
#![deny(clippy::all)]
#![forbid(unsafe_code)]

mod cli_args;
Expand All @@ -26,17 +26,17 @@ fn main() {
let spec = spec::read(&config.filename).deref_all();
let service = Service::new(&config, spec.servers[0].base_path());
let mutator = mutation::Mutator::new(&config.conv_filename);
let mut results = Vec::new();


// Create endpoints from the spec file.
let endpoints = spec.paths.iter().flat_map(|(path_name, methods)| {
let endpoints: Vec<operation::Endpoint> = spec.paths.iter().flat_map(|(path_name, methods)| {
operation::Endpoint::create_supported_endpoint(path_name, methods.to_item_ref())
});
}).collect();

let mut results = Vec::new();
let scenarios = endpoints.iter().flat_map(|e| mutator.mutate(e));

let start = Instant::now();
let scenarios = endpoints.flat_map(|e| mutator.mutate(&e));

for scenario in scenarios {
// println!("{:?}", scenario.instructions);
reporter::print_mutation_scenario(&scenario);
Expand Down
Loading

0 comments on commit b746eeb

Please sign in to comment.