-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for running benchmarks in a browser
To view, run `yarn ember server` and then visit `localhost:4200/bench` in a browser. Running under `node` is still supported.
- Loading branch information
1 parent
af77b18
commit ae8a9cf
Showing
12 changed files
with
103 additions
and
14 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
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,29 @@ | ||
import bench from "do-you-even-bench"; | ||
import Benchmark from "benchmark"; | ||
window.Benchmark = Benchmark; | ||
|
||
import DebounceCancel from "./benches/debounce-cancel"; | ||
import LaterCancel from "./benches/later-cancel"; | ||
import ScheduleCancel from "./benches/schedule-cancel"; | ||
import ScheduleFlush from "./benches/schedule-flush"; | ||
import ThrottleCancel from "./benches/throttle-cancel"; | ||
|
||
const suites = [ | ||
DebounceCancel, | ||
LaterCancel, | ||
ScheduleCancel, | ||
ScheduleFlush, | ||
ThrottleCancel, | ||
].flat(); | ||
|
||
const searchParams = new URLSearchParams(window.location.search); | ||
const filter = searchParams.get("filter"); | ||
|
||
if (filter) { | ||
document.querySelector("input[name=filter]").value = filter; | ||
suites = suites.filter((s) => | ||
s.name.toLowerCase().includes(filter.toLowerCase()) | ||
); | ||
} | ||
|
||
bench(suites); |
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,25 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Backburner.js Benchmarks</title> | ||
</head> | ||
<body> | ||
<form method="get"> | ||
<label for="filter">Filter by benchmark name:</label> | ||
<input name="filter" type="text" /> | ||
<button type="submit">Go</button> | ||
</form> | ||
<pre id="output"> | ||
</pre> | ||
<script src="/ember-cli-live-reload.js" type="text/javascript"></script> | ||
<script src="../loader.js"></script> | ||
<script src="../named-amd/backburner.js"></script> | ||
<script src="lodash.js"></script> | ||
<script src="browser-bench.js"></script> | ||
<script> | ||
window.Backburner = require("backburner").default; | ||
require("browser-bench"); | ||
</script> | ||
</body> | ||
</html> |
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