Skip to content

Commit

Permalink
Good looking light and dark performance charts (vercel#3113)
Browse files Browse the repository at this point in the history
Notable changes:
* Displaying labels for every sampled module count (1000, 5000, 10000, 30000)
* Thicker lines without points, larger text and legend
* Proper number and unit formatting, automatic switching between milliseconds and seconds
* Removed the title (we don't use it when embedding into the website)
* Light and dark themes
* Consistent ordering and colors for bundlers. **This means that if we want to add new bundlers, we'll have to edit the code.** In the future, we might want to do these mappings in a json file instead.

### Before

![image](https://user-images.githubusercontent.com/1621758/208966886-0aac50c8-2241-4c56-ba89-21cf6d339a1d.png)

### After

Dark:
![image](https://user-images.githubusercontent.com/1621758/208966619-548016aa-ed76-460a-85f1-7e721eaaabb8.png)

Light:
![image](https://user-images.githubusercontent.com/1621758/208966696-3b4fa98c-9827-4680-8caf-11f1c763eb1c.png)
  • Loading branch information
alexkirsz authored Dec 22, 2022
1 parent 03f349e commit 8d86ee5
Show file tree
Hide file tree
Showing 4 changed files with 303 additions and 114 deletions.
11 changes: 11 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ chrono = "0.4.22"
clap = { version = "4.0.18", features = ["derive"] }
indexmap = { workspace = true }
inquire = { version = "0.5.1" }
num-format = "0.4.4"
owo-colors = "3"
plotters = { version = "0.3.4", features = ["full_palette"] }
semver = "1"
Expand Down
9 changes: 7 additions & 2 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ To generate the summary json file:
Visualizations generated by this command will appear in a sibling directory to the summary data \
file.",
)
.arg(arg!(<PATH_TO_SUMMARY_JSON> "the path to the benchmark summary json file")),
.arg(arg!(<PATH_TO_SUMMARY_JSON> "the path to the benchmark summary json file"))
.arg(arg!(--bundlers <BUNDLERS> "comma separated list of bundlers to include in the visualization")),
)
}

Expand Down Expand Up @@ -166,9 +167,13 @@ fn main() {
let path = sub_matches
.get_one::<String>("PATH_TO_SUMMARY_JSON")
.expect("PATH_TO_SUMMARY_JSON is required");
let bundlers: Option<HashSet<&str>> = sub_matches
.get_one::<String>("bundlers")
.map(|s| s.split(',').collect());

let path = PathBuf::from(path);
let path = path.canonicalize().unwrap();
visualize_bundler_bench::generate(path).unwrap();
visualize_bundler_bench::generate(path, bundlers).unwrap();
}
_ => {
panic!("Unknown command {:?}", matches.subcommand().map(|c| c.0));
Expand Down
Loading

0 comments on commit 8d86ee5

Please sign in to comment.