Closed moving-bits closed 1 year ago
Thank you for contributing
Thank you for contributing
Yes, but does this really improve the performance (and or readability) of the code?
Thank you for contributing
Yes, but does this really improve the performance (and or readability) of the code?
Readability IMHO yes (but that's partly a matter of personal preference), and performance depends on which switch branch gets called.
From my point of view I can't see much more readability here valueLowerCase vs value.toLowerCase
.
The benefit I see is the single call of the function.
And may be an other one for the call with Locale.US
- when this is using an ASCII and not an UTF16 variant.
But the longer I look at this code, I see another optimization:
value
I'll do that the next days.
Avoids recalculation of
toLowerCase()
for every branch inaddLookupValue()