next up previous contents
Next: String Equality Benchmark Up: Benchmarks Previous: Allocation Benchmark   Contents

String Length Benchmark

Figure 2.2: This figure shows the amount of time required to determine the length of several short to medium sized strings
\epsfig{file=Length.eps, width=4.5in}\end{center}\end{figure}

Figure 2.2 shows the performance of taking the lengths of 9, 31, 65, and 257 character strings. In this test, the simple structure of the char* string lead to a big disadvantage with $O(n)$ runtime. Both Str and string do much better with $O(1)$ runtime.