-
-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a benchmark target and a script to run it (#365)
* Add a benchmark target and a script to run it Benchmarks need to be built in the release mode, that's why I created a separate `benchmark.sh` script to build it and run it. I've also cleaned up a compiler warning in `TextEditor.swift` and bumped macOS agents to use Xcode 12.3 instead of 12.2. * Benchmark `App` and `WindowGroup` rendering * Add a `benchmark` task to `tasks.json` * Exit `NativeDemo` directory before benchmarking
- Loading branch information
1 parent
67aea3c
commit 6f0528f
Showing
7 changed files
with
71 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import Benchmark | ||
import TokamakStaticHTML | ||
|
||
benchmark("render Text") { | ||
_ = StaticHTMLRenderer(Text("text")) | ||
} | ||
|
||
struct BenchmarkApp: App { | ||
var body: some Scene { | ||
WindowGroup("Benchmark") { | ||
Text("Hello, World!") | ||
} | ||
} | ||
} | ||
|
||
benchmark("render App") { | ||
_ = StaticHTMLRenderer(BenchmarkApp()) | ||
} | ||
|
||
benchmark("render List") { | ||
_ = StaticHTMLRenderer(List(1..<100) { Text("\($0)") }) | ||
} | ||
|
||
Benchmark.main() |
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,6 @@ | ||
#!/bin/bash | ||
|
||
set -eux | ||
|
||
swift build -c release --product TokamakStaticHTMLBenchmark | ||
./.build/release/TokamakStaticHTMLBenchmark |