Dmitri's CIS 610 Page

CIS 610: Data Structures and Algorithms

Course Page

Assignment 3

Assignment 4

Tromino trivia

How does strnmp(3) compare to memmove(3)?

I've been foolish enough to argue with my professor on speed of strncmp() vs. memmove. To prove (or disprove) it for myself, I wrote a C program to compare average cost of each function. Sample output looks like this:

        [root@plato root]# ./costs 4000000
        Average cost of strncmp: 34.53 nanoseconds
        Average cost of memmove: 1102.26 nanoseconds
        [root@plato root]#
        
I guess I was wrong... :)