Perbandingan Kinerja Operator == dan Fungsi Compare() dalam Pemrosesan String pada C++ - Muhammad Rofi Nur Fasyih; Dea Karuniawati; Pasha Ferbitama; Elvina Rizqi; Imam Prayogo Pujiono (Universitas Methodist Indonesia, 2025)
This study compared the performance of the equality operator (==) and the compare() function in C++ for strings. The focus was on their speed and memory efficiency when processing large data sets. Three datasets containing 100, 1,000, and 10,000 random strings ranging in length from 5 to 10 characters were used, each tested three times. Time was measured in microseconds, while memory usage was calculated in kilobytes. The results showed that the compare() function was faster, about 42% faster on the 100-string dataset, and about 9% to 10% faster on larger datasets. Memory usage was similar, differing by only a few hundred bytes. Therefore, use the equality operator (==) for simple comparisons or on small datasets, and use the compare() function for larger data sets. Further research should examine the impact of different compilers, optimization levels, and C++ standard library implementations on these results, as well as include formal statistical analysis of the measured data.