Skip to content

Add CodSpeed performance benchmarks#9

Closed
codspeed-hq[bot] wants to merge 2 commits intomasterfrom
codspeed-wizard-1772557349480
Closed

Add CodSpeed performance benchmarks#9
codspeed-hq[bot] wants to merge 2 commits intomasterfrom
codspeed-wizard-1772557349480

Conversation

@codspeed-hq
Copy link

@codspeed-hq codspeed-hq bot commented Mar 3, 2026

Summary

  • Added performance benchmarks for the lexer, parser, and bytecode builder using google_benchmark through the CodSpeed compatibility layer
  • Created a dedicated CodSpeed GitHub Actions workflow that runs benchmarks in simulation mode on every push to master and on pull requests
  • Added the CodSpeed badge to the README

Changes

Benchmarks (bench/)

Three benchmark files covering the main components:

  • lexer_bench.cpp: Measures lexing throughput on simple, medium, and complex programs
  • parser_bench.cpp: Measures parsing throughput (with pre-lexed tokens) and combined lex+parse performance
  • bytecode_builder_bench.cpp: Measures bytecode emission for arithmetic ops, jumps, and a simulated loop construct

Build system (CMakeLists.txt)

  • Added ENABLE_BENCHMARKS option (default OFF) to build benchmarks independently of tests
  • google_benchmark is fetched via FetchContent from CodSpeed's compatibility layer, which provides instrumented measurements in CI
  • The benchmark executable pxkorka_benchmarks links against korka_lib and benchmark::benchmark

CI workflow (.github/workflows/codspeed.yml)

  • Runs on ubuntu-24.04 with GCC 14 (matching the existing build workflow)
  • Builds with -DCODSPEED_MODE=simulation and RelWithDebInfo for meaningful profiling data
  • Uses OIDC authentication (tokenless) via CodSpeedHQ/action@v4

Next steps

  • After merging, performance reports will appear on future pull requests automatically
  • Visit CodSpeed to view performance trends and flame graphs
  • Consider adding more benchmarks as the compiler and VM runtime components are completed

@codspeed-hq codspeed-hq bot force-pushed the codspeed-wizard-1772557349480 branch from b2b6d9b to 4f5aaa0 Compare March 3, 2026 17:10
@codspeed-hq
Copy link
Author

codspeed-hq bot commented Mar 3, 2026

Congrats! CodSpeed is installed 🎉

🆕 10 new benchmarks were detected.

You will start to see performance impacts in the reports once the benchmarks are run from your default branch.

Detected benchmarks


Open in CodSpeed

@codspeed-hq codspeed-hq bot marked this pull request as ready for review March 3, 2026 17:12
@PyXiion PyXiion closed this Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant