69std::unique_ptr<BOARD> buildBoardWithGroups( std::size_t aGroupCount, std::size_t aTotalShapes )
71 auto board = std::make_unique<BOARD>();
74 std::vector<PCB_GROUP*> groups;
75 groups.reserve( aGroupCount );
77 for( std::size_t g = 0; g < aGroupCount; ++g )
80 group->SetName( wxString::Format( wxT(
"G%zu" ), g ) );
82 groups.push_back(
group );
85 for( std::size_t i = 0; i < aTotalShapes; ++i )
88 int x =
static_cast<int>( i );
96 groups[i % groups.size()]->AddItem( shape );
109double saveBoardSeconds(
const std::filesystem::path& aDir, std::size_t aGroupCount,
110 std::size_t aTotalShapes )
112 auto board = buildBoardWithGroups( aGroupCount, aTotalShapes );
114 const std::filesystem::path savePath =
115 aDir / (
"groups" + std::to_string( aGroupCount ) +
".kicad_pcb" );
121 return timer.
msecs() / 1000.0;
143 constexpr std::size_t kTotalShapes = 5000;
149 (void) saveBoardSeconds( tempDir.
GetPath(), 10, 100 );
154 [&]( std::size_t aGroupCount )
156 double best = std::numeric_limits<double>::infinity();
158 for(
int run = 0; run < 2; ++run )
160 best = std::min( best, saveBoardSeconds( tempDir.
GetPath(), aGroupCount,
167 double t100 = bestSave( 100 );
168 double t5000 = bestSave( 5000 );
175 const double floorSec = 0.005;
176 double ratio = t5000 / std::max( t100, floorSec );
184 BOOST_CHECK_LT( ratio, 20.0 );
constexpr EDA_IU_SCALE pcbIUScale
General utilities for PCB file IO for QA programs.
A temporary directory that will be deleted when it goes out of scope.
const std::filesystem::path & GetPath() const
static const LSET & AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
A set of BOARD_ITEMs (i.e., without duplicates).
void SetEnd(const VECTOR2I &aEnd) override
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetStart(const VECTOR2I &aStart) override
void SetStroke(const STROKE_PARAMS &aStroke) override
A small class to help profiling.
void Stop()
Save the time when this function was called, and set the counter stane to stop.
double msecs(bool aSinceLast=false)
Simple container to manage line stroke parameters.
void DumpBoardToFile(BOARD &board, const std::string &aFilename)
Utility function to simply write a Board out to a file.
Class to handle a set of BOARD_ITEMs.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END()
BOOST_TEST_MESSAGE("\n=== Real-World Polygon PIP Benchmark ===\n"<< formatTable(table))
VECTOR2< int32_t > VECTOR2I