perf: aplicar checks performance-* (91 fixes)

Cambios aplicados:
- Reemplazar std::endl con '\n' (91 casos)
  * std::endl hace flush del buffer (más lento)
  * '\n' solo inserta newline (más rápido)
  * Mejora rendimiento de logging/debug

Check excluido:
- performance-enum-size: Tamaño de enum no es crítico para rendimiento
This commit is contained in:
2025-12-18 21:24:07 +01:00
parent 7f6af6dd00
commit 364cf36183
17 changed files with 94 additions and 92 deletions
+6 -6
View File
@@ -17,7 +17,7 @@ std::shared_ptr<Shape> ShapeLoader::load(const std::string& filename) {
// Check cache first
auto it = cache_.find(filename);
if (it != cache_.end()) {
std::cout << "[ShapeLoader] Cache hit: " << filename << std::endl;
std::cout << "[ShapeLoader] Cache hit: " << filename << '\n';
return it->second; // Cache hit
}
@@ -33,7 +33,7 @@ std::shared_ptr<Shape> ShapeLoader::load(const std::string& filename) {
std::vector<uint8_t> data = Resource::Helper::loadFile(normalized);
if (data.empty()) {
std::cerr << "[ShapeLoader] Error: no s'ha pogut carregar " << normalized
<< std::endl;
<< '\n';
return nullptr;
}
@@ -42,19 +42,19 @@ std::shared_ptr<Shape> ShapeLoader::load(const std::string& filename) {
auto shape = std::make_shared<Shape>();
if (!shape->parsejar_fitxer(file_content)) {
std::cerr << "[ShapeLoader] Error: no s'ha pogut parsejar " << normalized
<< std::endl;
<< '\n';
return nullptr;
}
// Verify shape is valid
if (!shape->es_valida()) {
std::cerr << "[ShapeLoader] Error: forma invàlida " << normalized << std::endl;
std::cerr << "[ShapeLoader] Error: forma invàlida " << normalized << '\n';
return nullptr;
}
// Cache and return
std::cout << "[ShapeLoader] Carregat: " << normalized << " (" << shape->get_nom()
<< ", " << shape->get_num_primitives() << " primitives)" << std::endl;
<< ", " << shape->get_num_primitives() << " primitives)" << '\n';
cache_[filename] = shape;
return shape;
@@ -62,7 +62,7 @@ std::shared_ptr<Shape> ShapeLoader::load(const std::string& filename) {
void ShapeLoader::clear_cache() {
std::cout << "[ShapeLoader] Netejant caché (" << cache_.size() << " formes)"
<< std::endl;
<< '\n';
cache_.clear();
}