mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00

StringBeginsWith (resp. StringEndsWith) takes a defaulted nsStringComparator object for doing comparisons. The flexibility this affords is great, but the cost is not: nsStringComparator has virtual methods, so initializing that defaulted object (at every callsite) requires a temporary object whose vtable must be initialized. Since the overwhemingly common case is to use the default comparator anyway, we should not use defaulted arguments and instead provide the default comparator/user-provided comparator cases as separate overloads. This change eliminates the virtual call for the majority of callsites and reduces codesize as well.