mozilla/pdf.js — pull request #3354 by fkaelberer (2013-06-11 14:18:35+00:00)
Title: Faster type3 glyph outlines

This PR implements a major speed bump for type3 font rendering, especially for Firefox.
Using the documents below, the rendering times are reduced by 70% on Firefox 23 (and 36% on Chrome 27).

Speedups are achieved (in decreasing order of significance) by:
- avoiding Function constructor (doubles speed on Firefox, smaller bump on Chrome)
- using dense arrays for point types (faster on Firefox, slower on Chrome)
- using flat arrays for point types (faster on Chrome)
- using lookup tables to construct point type array
- some bit twiddling

This is my very first contribution to an open source project, so I hope everything runs well (and I hope for some feedback).

Used Documents (the standard test set doesn't contain much type3 text):
https://github.com/mozilla/pdf.js/issues/918, https://github.com/mozilla/pdf.js/issues/2378, https://github.com/mozilla/pdf.js/issues/2791, https://github.com/mozilla/pdf.js/issues/2984

browser | stat | Baseline(ms) | Current(ms) | +/- | % | Result(P<.05)
-----------------------------------------------------------------------------------
firefox23 | Font Loading | 1 | 1 | 1 | 50.65 |
firefox23 | Overall | 966 | 328 | 639 | 66.1 | faster
firefox23 | Page Request | 53 | 53 | 0 | 0.45 |
firefox23 | Rendering | 912 | 274 | 638 | 69.97 | faster