The growing performance gap between multi-core CPUs and main memory necessitates hardware-aware software design paradigms. This study provides a comprehensive performance analysis of Data Oriented Design (DOD) versus the traditional Object-Oriented Design (OOD), focusing on cache utilization and efficiency in multi-threaded environments. We developed and compared four distinct versions of the A* search algorithm: single-threaded OOD (ST-OOD), single-threaded DOD (ST-DOD), multi-threaded OOD (MT-OOD), and multi-threaded DOD (MT-DOD). The evaluation was based on metrics including execution time, memory usage, and CPU cache misses. In multi-threaded tests, the DOD implementation demonstrated considerable performance gains, with faster execution times and a lower number of raw system calls and cache misses. While OOD occasionally showed marginal advantages in memory usage or percentage-based cache miss rates, DOD's efficiency in data-intensive operations was more evident. Furthermore, our findings reveal that for a fine-grained task like the A* algorithm, the overhead associated with thread management led to single-threaded versions significantly outperforming their multi-threaded counterparts in both paradigms. We conclude that even when performance differences appear subtle in simple algorithms, the consistent advantages of DOD in critical metrics highlight its foundational architectural superiority, suggesting it is a more effective approach for maximizing hardware efficiency in complex, large-scale AI and parallel computing tasks.
翻译:多核CPU与主内存之间日益扩大的性能差距要求采用硬件感知的软件设计范式。本研究对数据导向设计(DOD)与传统面向对象设计(OOD)进行了全面的性能分析,重点关注多线程环境中的缓存利用率和效率。我们开发并比较了A*搜索算法的四个不同版本:单线程OOD(ST-OOD)、单线程DOD(ST-DOD)、多线程OOD(MT-OOD)和多线程DOD(MT-DOD)。评估基于执行时间、内存使用率和CPU缓存未命中率等指标。在多线程测试中,DOD实现表现出显著的性能提升,具有更快的执行时间以及更少的原始系统调用和缓存未命中次数。虽然OOD偶尔在内存使用率或基于百分比的缓存未命中率方面显示出微弱优势,但DOD在数据密集型操作中的效率更为明显。此外,我们的研究结果表明,对于像A*算法这样的细粒度任务,线程管理相关的开销导致单线程版本在两种范式中均显著优于其多线程对应版本。我们得出结论:即使在简单算法中性能差异看似细微,DOD在关键指标上的一致优势凸显了其基础架构的优越性,表明对于复杂、大规模人工智能及并行计算任务中最大化硬件效率而言,DOD是一种更有效的方法。