@dahjelle, etc... Agreed that if you have common values a dictionary based lookup would help. Regarding Canvas: while I don't doubt it could be faster, the simplicity in your JSPerf is not very robust. There are a bunch of other CSS properties that can affect the width of text. I don't have a comprehensive list, but yours is missing a bunch (e.g., font-weight, letter-spacing, text-transform, etc.).
I saw a bunch of other half-baked implementations on StackOverflow originally that just picked specific CSS properties to care about. Without figuring out a comprehensive list (and having a longer JS implementation), my solution seemed to be the shortest & most complete.