jbcoe / jbcoe/cc-protocol

Share interfaces across the operator tests to cut compile time

Open
#404 0 comments 0 reactions 0 assignees View on GitHub
Important
Dominant language
C++
Stars
11
Forks
4
Avg merge
16h 39m
Merged PRs (30d)
131

Description

Each of the ~38 tests in protocol_operator_tests.cc declares its own `Interface`/`Conforming` pair and instantiates `protocol`, `protocol_view` and `protocol_view`, so the TU drives about 132 separate `define_aggregate` vtable and wrapper generations.

| Build | Time |
|---|---|
| gtest + protocol.hh baseline, `-O2 -c` | 1.1 s |
| protocol_operator_tests.cc, `-fsyntax-only` | 4.3 s |
| protocol_operator_tests.cc, `-O2 -c` | 6.0 s |

Roughly 3 s of that is instantiation, paid in every job that builds the tests (cmake, bazel, three sanitizer configs, runtime coverage, clang-tidy) and more under clang-p2996. A matched experiment with 22 binary operators through all three wrapper kinds costs 1.5 s above baseline with one interface per test and 0.7 s with one shared interface.

This is a test-structure optimisation, not a design question: per-test interfaces keep each test self-contained, and a shared interface per operator family (arithmetic, bitwise, compound assignment, shifts) keeps most of that while halving the work. Related to the CI-time work in #374.

Contributor guide

Open the contributing guide

Research direction

Start with protocol_operator_tests.cc and inspect how each test declares its Interface/Conforming pair and instantiates protocol, protocol_view, and protocol_view. Group the relevant tests by operator family while preserving their coverage, then run the test target and repeat the issue's compile-time measurements. Done means the tests still pass and the shared interfaces reduce instantiation time.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system, performance, testing-qa
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.