nodebox/opentype.js — pull request #35 by fpirsch (2014-04-24 20:34:30+00:00)
Title: Make opentype.js 2x faster

Profiling the code shows that most of the parsing time is spent in parseByte() and isBitSet(), both of which can be called hundreds of thousands of times for a single font (about 450,000 times to parse the Times New Roman font, 50,000 times to parse Roboto Black).
• isBitSet() is completely removed and replaced by direct bitwise arithmetic.
• the Parser class is simplified : it no longer accepts simple arrays and focuses on DataViews, and directly calls the DataView methods instead of getByte() / getShort()

As a result, parsing a font now takes approximately 50% less time ツ

This is just a start, hunting down unnecessary function calls and property lookups could further improve performance.