Ricardo Montañana Gómez
c408352daa
Eliminate redundant memory and enhance memory usage
1. Eliminated Redundant Memory Usage
- Before: Maintained both X (float) and Xs (string) vectors simultaneously → 2x memory usage
- After: Use temporary categoricalData only during processing, deallocated automatically → ~50% memory reduction
2. Implemented Memory Pre-allocation
- Before: Vectors grew dynamically causing memory fragmentation
- After: X.assign(numFeatures, std::vector<float>(numSamples)) pre-allocates all memory upfront
- Benefit: Eliminates reallocation overhead and memory fragmentation
3. Added Robust Exception Handling
- Before: stof(token) could crash on malformed data
- After: Wrapped in try-catch with descriptive error messages
- Improvement: Prevents crashes and provides debugging information
4. Optimized String Processing
- Before: type += type_w + " " caused O(n²) string concatenation
- After: Used std::ostringstream for efficient string building
- Benefit: Better performance on files with complex attribute types
2025-06-27 18:20:06 +02:00
..
2024-06-12 18:17:03 +02:00
2025-01-09 10:10:01 +01:00
2024-05-21 12:44:33 +02:00
2025-06-27 18:20:06 +02:00