fastcache icon indicating copy to clipboard operation
fastcache copied to clipboard

why not byte.Compare for this fastcache.go?

Open gitmko0 opened this issue 5 years ago • 8 comments

:392

byte.compare shld be faster?

if string(k) == string(chunk[idx:idx+keyLen]) {

gitmko0 avatar Oct 18 '20 15:10 gitmko0

Why it should?

cristaloleg avatar Oct 18 '20 15:10 cristaloleg

byte comparison is faster?

gitmko0 avatar Oct 18 '20 17:10 gitmko0

Why it should be?

cristaloleg avatar Oct 18 '20 18:10 cristaloleg

no need conversion of bytes to string

gitmko0 avatar Oct 18 '20 19:10 gitmko0

there are many other optimization opportunities but this is one the most obvious. it's being used as a cache so let's make it as fast as it can be?

gitmko0 avatar Oct 19 '20 08:10 gitmko0

other optimization opportunities

which one?

cristaloleg avatar Oct 19 '20 10:10 cristaloleg

This one https://github.com/VictoriaMetrics/fastcache/issues/36

gitmko0 avatar Nov 02 '20 00:11 gitmko0