The code division
The code division¶
Self-measurement of the bonsai tree, no comparison: line counts and lizard complexity per plane at one SHA. LOC is wc -l; NLOC is lizard's non-blank, non-comment count; CCN is cyclomatic complexity (independent paths through a function). The plane map and the non-claims: the benchmark protocol.
| plane | files | LOC | NLOC | functions | mean CCN | max CCN |
|---|---|---|---|---|---|---|
| core_headers | 54 | 4942 | 3618 | 215 | 2.04 | 15 |
| engine_impl | 19 | 5440 | 4500 | 209 | 3.20 | 29 |
| cuda_plane | 12 | 3582 | 2824 | 133 | 3.02 | 24 |
| bindings_cli | 20 | 3026 | 2256 | 124 | 2.67 | 29 |
| bench_tooling | 53 | 9977 | 6852 | 360 | 4.67 | 39 |
| tests | 40 | 10205 | 8071 | 473 | 1.77 | 12 |
| all | 198 | 37172 | 28121 | 1514 | - | - |
The five highest-CCN functions across core_headers + engine_impl, published by name; a curated offender list would be marketing.
| function | file | CCN | NLOC |
|---|---|---|---|
bonsai::detail::csv::parse |
src/io/csv.cpp |
29 | 143 |
bonsai::detail::libsvm::parse |
src/io/csv.cpp |
20 | 99 |
bonsai::MulticlassBooster::update_one_iter |
include/bonsai/multiclass_booster.hpp |
15 | 84 |
bonsai::greedy_weighted_cuts |
src/bin_mapper.cpp |
15 | 51 |
bonsai::LeafwiseGrower<EngineT,SplitterT>::grow |
src/grower_impl.hpp |
15 | 109 |
Surface counts: 45 config parameters, 105 registered dispatch combinations (7 objectives x 5 growers x 3 samplers), and 9 public Python names. Dependencies: 1 Python runtime dependency (numpy) and 3 compiled-in C++ libraries (CLI11, nlohmann_json, tomlplusplus), the rule stated in the protocol.
Source: code-metrics-2026-07.jsonl. lizard 1.23.0 (uvx lizard@1.23.0) at ee318c873905, 2026-07-31; regenerate with scripts/measure_complexity.py; superseded in place on re-measurement (decision 69).