[Bug 847894] improve typing performance [r=crdlc]

https://bugzilla.mozilla.org/show_bug.cgi?id=847894