If both the memory addresses of the first bytes are equal, then the fast 
route will be selected by comparing their lengths.
Otherwise, byte by byte. 

On Wednesday, February 10, 2021 at 5:22:28 AM UTC-5 cuiw...@gmail.com wrote:

> i look into map key compare key about string,it will use runtime·memequal, 
> i thing the stra == strb will call memequal  two.
>
>
> On Wednesday, February 10, 2021 at 6:12:18 PM UTC+8 xie cui wrote:
>
>> compare two byte slice,will convert to compare between two string, and my 
>> question is how golang compare two string, i don't think that it just 
>> compare the len and then comapare bytes in string one byte by one byte, it 
>> should have some optimization?where is the code in compiler generate the 
>> compare codes?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/190074fa-c1d6-41a5-a0fc-ef3e0d62a5c8n%40googlegroups.com.

Reply via email to