How danielleodigie/red-queen works
Main Components
• Benchmark Runner & Integration Layer – Note that pytest forms the core test runner. This layer includes:
– The pytest entry point along with configuration files (pyproject.toml, pytest.ini, conftest.py).
– Integration with pytest plugins (pytest-xdist and pytest-benchmark) as inspirations.
• Benchmark Definitions – These are the “bench_*” functions mostly located in red_queen/games/mapping/map_queko.py along with similar modules in red_queen/games/applications.
• Quantum Assembly Data and Benchmarks – The repository contains hundreds of .qasm files within structured subdirectories (e.g., red_queen/games/applications/qasm and red_queen/games/mapping/benchmarks) that represent the input circuits for the benchmarking algorithms.
• Core Framework Modules – In the red_queen directory you see modules like bishop.py, knight.py, pawn.py, queen.py, and rook.py. These encapsulate core functionality and abstract pieces of the quantum compilation process.
• Reporting & Result Storage – A separate “report” module (with console_tables and loader) handles processing of benchmark results stored as JSON (invoked via the “--store” option). This component takes the stored results, formats the data, and displays tabular results in a console application.
• Utility and Test Support – Files like fixtures.py, test configurations (pytest.ini, tox.ini) and continuous integration workflows (under .github) support quality checks and automated testing.
Relationships and Data Flow
• From pytest, the execution flows into the Benchmark Definitions which call core modules (chess piece modules) and the mapping / application algorithms.
• In the course of execution, the framework processes quantum assembly (.qasm) files as input data for benchmarking.
• A “Results Handler” component then collects outcomes and, if “--store” is used, stores them as JSON in a designated results directory.
• Finally, a reporting tool (from the “report” module) reads these JSON result files and presents them in table format, returning the output to the user.
Architectural Patterns and Technologies
• Layering: Clear separation between the test/benchmark definitions, core compilation components, data (qasm benchmarks), and the presentation/reporting layer.
• Integration with external testing frameworks: Leveraging pytest and markers to filter tests.
• Extensibility: The folder structure under “games” (with subdivisions for mapping benchmarks and applications) indicates that additional benchmark types can be added easily.
• Use of configuration and CI/CD (via .github/workflows) to maintain quality.