Make raw string as `[]byte` instead of `string` for efficiency
Converting string to []byte is not a typecast but a mem copy and rebuilding, hence it becomes expensive.
@arpitbbhayani I didn't understood your question. In title you have written that you want this change for efficiency, but in above comment you have written that it is expensive. If mem copy and rebuilding operation is expensive, then it will decrease the efficiency right?
@arpitbbhayani where do we have to make changes ?
@deeplearningera "Converting string to []byte is not a typecast" implies while processing when we do this, it will be expensive. Hence we should not have string at all and instead just []byte.
@heysujal would recommend you go through the code and find a place where we are using RAW encoding.
https://github.com/DiceDB/dice/blob/c9ac91786788b709b65440e488545099861bc408/core/type_string.go#L7
found this. I am not familiar with Golang and also to redis.
So, only changing v string to []byte(v) would do the job ?
https://github.com/DiceDB/dice/blob/c9ac91786788b709b65440e488545099861bc408/core/object.go#L16 this also uses raw encoding
Came across an interesting blog on this topic: https://syslog.ravelin.com/byte-vs-string-in-go-d645b67ca7ff Anyone working on this can refer this to get an insight as to why its a memory allocation and not just simple type-casting
@asutosh97 Still a valid issue? cc - @JyotinderSingh @arpitbbhayani
@AshwinKul28 / @JyotinderSingh anyone looking to work on this ?
Thanks @sbshah97 for the interest. Unfortunately, this was a very old issue and we are revamping the store, and query operations. This issue is not relevant now; though we will open more relevant ones soon after the rewrite. Closing this.