commit 70d16de60a3249cb33d96fcf745c671c45849021
parent 298a96b48f29baf082ac4d3c551fab2b6398c66b
Author: Andrew Laack <andrew@laack.co>
Date: Wed, 30 Sep 2026 21:18:50 -0500
Flamegraph command for benchmarking ease
Diffstat:
3 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -4,3 +4,6 @@ vgcore*
*.gcda
coverage-html/
*.info
+*.folded
+*.data
+*.svg
diff --git a/Makefile b/Makefile
@@ -49,7 +49,12 @@ crash-test:
benchmark:
${BCOMMAND_P} benchmarking/render-bench.cpp ${BCOMMAND_S} -o bench1.out
- ./bench1.out
+ perf record -g ./bench1.out
+ rm bench1.out
+
+flamegraph:
+ perf script | ~/gitRepos/FlameGraph/stackcollapse-perf.pl > out.folded
+ ~/gitRepos/FlameGraph/flamegraph.pl out.folded > flamegraph.svg
test: pure-test browser-test fetch-test puppet-test
lcov --capture --directory . --output-file coverage.info \
diff --git a/benchmarking/render-bench.cpp b/benchmarking/render-bench.cpp
@@ -21,8 +21,30 @@ std::string genAlNumNlSp(const int len) {
return tmp_s;
}
+TEST_CASE("Benchmark web browsing") {
+ setenv("EDITOR", "test" , 1);
+
+ BENCHMARK("Access my website") {
+ Browser* bPtr = new Browser {};
+ Browser& b = *bPtr;
+ DrawState ds {};
+ ds.bPtr = bPtr;
+ REQUIRE(mainLoop(ds, b, 'o',0,0));
+ REQUIRE(mainLoop(ds, b, 'l',0,0));
+ REQUIRE(mainLoop(ds, b, 'a',0,0));
+ REQUIRE(mainLoop(ds, b, 'a',0,0));
+ REQUIRE(mainLoop(ds, b, 'c',0,0));
+ REQUIRE(mainLoop(ds, b, 'k',0,0));
+ REQUIRE(mainLoop(ds, b, '.',0,0));
+ REQUIRE(mainLoop(ds, b, 'c',0,0));
+ REQUIRE(mainLoop(ds, b, 'o',0,0));
+ REQUIRE(mainLoop(ds, b, '\n',0,0));
+ REQUIRE(b.getCurrentLink()->getLinkDestination().to_string() == "gemini://laack.co");
+ delete bPtr;
+ };
+}
-TEST_CASE("Benchmarking huge file scrolling") {
+TEST_CASE("Benchmarking huge file scrolling", "[.]") {
setenv("EDITOR", "test" , 1);
writeStringToFile(genAlNumNlSp(10000000), "tests/example.out");
BENCHMARK("5 passes per iteration, 10m character file, load, scroll down 1000x, scroll up 1000x with 100x100 emulated terminal size") {