|
KiCad PCB EDA Suite
|
Regression performance test for https://gitlab.com/kicad/code/kicad/-/issues/24251. More...
#include <algorithm>#include <cstddef>#include <filesystem>#include <limits>#include <memory>#include <string>#include <vector>#include <qa_utils/wx_utils/unit_test_utils.h>#include <board.h>#include <core/profile.h>#include <lset.h>#include <pcb_group.h>#include <pcb_shape.h>#include <pcbnew_utils/board_file_utils.h>#include <pcbnew_utils/board_test_utils.h>Go to the source code of this file.
Functions | |
| BOOST_AUTO_TEST_CASE (SaveScalesLinearlyWithGroupCount) | |
| Save boards with the same shape count but very different group counts. | |
Regression performance test for https://gitlab.com/kicad/code/kicad/-/issues/24251.
PCB_IO_KICAD_SEXPR::format(PCB_GROUP*) previously rebuilt a local std::unordered_set<EDA_ITEM*> from the board's full item-by-id cache once per group. With G groups and N board items the save was O(G * N). This test saves boards with the same shape count but very different group counts and verifies the save cost scales roughly linearly with the group count rather than quadratically.
Definition in file test_group_save_perf.cpp.
| BOOST_AUTO_TEST_CASE | ( | SaveScalesLinearlyWithGroupCount | ) |
Save boards with the same shape count but very different group counts.
Pre-fix, the format() of each group rebuilt a pointer set scanning the full item-by-id cache, so the per-group cost grew with the board's item count and the total cost grew quadratically in the group count.
We check that scaling is sub-quadratic with a generous margin so the test is robust against debug builds, CI noise and slow VMs while still failing if the O(N^2) regression returns.
Definition at line 141 of file test_group_save_perf.cpp.
References BOOST_AUTO_TEST_CASE(), BOOST_TEST_MESSAGE(), and KI_TEST::TEMPORARY_DIRECTORY::GetPath().