monday icon indicating copy to clipboard operation
monday copied to clipboard

faster case-insensitive search

Open saurabhagrawal-86 opened this issue 4 years ago • 1 comments

The findInString(where, what string) function implements a case-insensitive search by converting both strings to lowercase using strings.ToLower() and then using the inbuilt strings.Index() function. However, the strings.ToLower() function is expensive as it needs to allocate new memory to construct a string.

This diff attempts to optimize findInString() implementation by avoiding the construction of any new strings in the implementation.

The results of the BenchmarkFormat test show ~35-40% improvement.

Before: BenchmarkFormat-12 610 1788567 ns/op After: BenchmarkFormat-12 880 1336956 ns/op

saurabhagrawal-86 avatar Apr 23 '21 12:04 saurabhagrawal-86

@goodsign could you please review this PR?

saurabhagrawal-86 avatar Apr 24 '21 15:04 saurabhagrawal-86