Perbandingan Kinerja Operator == dan Fungsi Compare() dalam Pemrosesan String pada C++

Authors

  • Muhammad Rofi Nur Fasyih UIN K.H. Abdurrahman Wahid Pekalongan
  • Dea Karuniawati UIN K.H. Abdurrahman Wahid Pekalongan
  • Pasha Ferbitama UIN K.H. Abdurrahman Wahid Pekalongan
  • Elvina Rizqi UIN K.H. Abdurrahman Wahid Pekalongan
  • Imam Prayogo Pujiono UIN K.H. Abdurrahman Wahid Pekalongan

Keywords:

String Comparison, Performance Analysis, C , Compare Function, Comparison Operators

Abstract

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.

Published

2025-12-15

Issue

Section

TAMIKA: Jurnal Tugas Akhir Manajemen Informatika & Komputerisasi Akuntansi