Optimize stringlist functions

The get_string() function becomes a major bottleneck (around 80% of
the time) when debug info is on because it uses a linked list for
storage and it's mostly called in for loops iterating over the whole
list by index. That's a quadratic complexity.

This patch rewrites all stringlist functions to use an array instead
of a linked list. It decreased my test script's compile time from 84s
to 10s, or by 730%(!). The script is just 100,000 lines of print()
statements. If debug info is turned off the times are the same for both
implementations.