Inefficient implementation of "strstr" function in SunOS 4.1.3

We find out that string function "strstr" has inefficient implementation in SunOS 4.1.3. This is because the implementation of "strstr" in SunOS 4.1.3 unnessarily calles "strlen" each time it finishes one "strncmp" between the two strings. This code can be very slow when the string to be searched is large.
For example, suppose strstr is used to get a substring of a 8K string and the substring begins at the middle point of the 8K string, strstr will call strlen 4K times which is totally unnessary!!

Go back to the ATOMIC-2 home page. / Go back to the ISI home page.
This page written and maintained by the
ATOMIC-2 group.
Please mail us any problems with or
comments about this page.
Last modified June 5, 1995.