MCPcopy Create free account
hub / github.com/ThatOpen/engine_web-ifc / Benchmark

Function Benchmark

src/cpp/test/web-ifc-test.cpp:353–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351};
352
353void Benchmark()
354{
355 std::vector<BenchMarkResult> results;
356 std::string path = "../../../benchmark/ifcfiles";
357 for (const auto &entry : std::filesystem::directory_iterator(path))
358 {
359 if (entry.path().extension().string() != ".ifc")
360 {
361 continue;
362 }
363
364 std::string filePath = entry.path().string();
365 std::string filename = entry.path().filename().string();
366
367 std::string content = ReadFile(filePath);
368
369 auto start = ms();
370 {
371 // loader.LoadFile(content);
372 }
373 auto time = ms() - start;
374
375 BenchMarkResult result;
376 result.file = filename;
377 result.timeMS = time;
378 result.sizeBytes = entry.file_size();
379 results.push_back(result);
380
381 std::cout << "Reading " << result.file << " took " << time << "ms" << std::endl;
382 }
383
384 std::cout << std::endl;
385 std::cout << std::endl;
386 std::cout << "Results:" << std::endl;
387
388 double avgMBsec = 0;
389 for (auto &result : results)
390 {
391 double MBsec = result.sizeBytes / 1000.0 / result.timeMS;
392 avgMBsec += MBsec;
393 std::cout << result.file << ": " << MBsec << " MB/sec" << std::endl;
394 }
395
396 avgMBsec /= results.size();
397
398 std::cout << std::endl;
399 std::cout << "Average: " << avgMBsec << " MB/sec" << std::endl;
400
401 std::cout << std::endl;
402 std::cout << std::endl;
403}
404
405void TestTriangleDecompose()
406{

Callers

nothing calls this directly

Calls 3

ReadFileFunction · 0.85
sizeMethod · 0.80
msFunction · 0.70

Tested by

no test coverage detected