Like strlen() from glibc that performs a nice bit manipulation and 4 bytes checked per time making the function so fast, compared to a byte-by-byte routine as most all others do, is there something like this to compare two strings in assembly? I’m reading some pages on code implementation for C language, very interested in strings-handling part, but I still not found none like this.
I have to make this function as fast possible because it’s the heart of my application.(don’t recommend hash table)
Any assembler is welcome. But I’m a bit familiar with intel’s assembly syntax, if assembly that you’ll go to provide is different, please comment it.
You can compare word by word (eg. 32-bits or 64-bits at a time). You just need to be careful not to go past the end of the string. If you are making the strings, then you could pad them with zeroes so they are a multiple of the word size, then you don’t even need to check.