From 8fea317e46bb209ab81c0c2500e1eef48788812b Mon Sep 17 00:00:00 2001 From: Ankur Anand Date: Thu, 26 Sep 2019 11:34:25 +0530 Subject: [PATCH] Efficiently Compare Strings with strings.EqualFold --- performance.md | 1 + 1 file changed, 1 insertion(+) diff --git a/performance.md b/performance.md index dba44eb..3821094 100644 --- a/performance.md +++ b/performance.md @@ -997,6 +997,7 @@ allocate it. But you also pay every time the garbage collection runs. * consider alternate random number generation (go-pcgr, xorshift) * binary.Read and binary.Write use reflection and are slow; do it by hand. (https://github.com/conformal/yubikey/commit/613e3b04ae2eeb78e6a19636b8ff8e9106d2e7bc) * use strconv instead of fmt if possible +* Use `strings.EqualFold(str1, str2)` instead of `strings.ToLower(str1) == strings.ToLower(str2)` or `strings.ToUpper(str1) == strings.ToUpper(str2)` to efficiently compare strings if possible. * ... ## Alternate implementations