mozilla/pdf.js — pull request #5137 by CodingFabian (2014-08-05 21:55:12+00:00)
Title: Optimize TextLayerBuilder_renderLayer() for text heavy documents.

This change improves the text layer creation of "normal" text heavy documents.
It changes 2 things:
* If the text element is not rotated, it will neither calculate nor apply a
textTransform: rotate(0deg) to the text layer element.
* For scaling the text layer div, the context will measure the width of the
text in the given font. For many text documents the font changes seldom.
If the font stays the same, the context does not need to be set to a new font
especially avoiding the temporary creation of the same font string over and
over again.

The PDF from #4873 suits well as an example. I added counts for where rotation is zero, and the font is the the same. Rotation of all text elements (many thousands) is zero, and the font is often for hundreds of elements the same.