Use a switch table for enum->string conversion, which avoids runtime memory allocation.

We'll surely need a good review of this, but I think it's an interesting optimization!