Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce the number of function calls in the
Dict
class
The following changes were made: - Remove unnecessary `typeof` checks in the `get`/`getAsync` methods. - Reduce unnecessary code duplication in the `get`/`getAsync` methods. - Inline the `Ref` checks in the `get`/`getAsync`/`getArray` methods, since it helps avoid many unnecessary functions calls. I.e. this way it's possible to directly call `XRef.{fetch, fetchAsync)` only when necessary, rather than always having to call `XRef.{fetchIfRef, fetchIfRefAsync)`. This patch was tested using the PDF file from issue 2618, i.e. http://bugzilla-attachments.gnome.org/attachment.cgi?id=226471, using the following manifest file: ``` [ { "id": "issue2618", "file": "../web/pdfs/issue2618.pdf", "md5": "", "rounds": 250, "type": "eq" } ] ``` This gave the following results when comparing this patch against the `master` branch: ``` -- Grouped By browser, stat -- browser | stat | Count | Baseline(ms) | Current(ms) | +/- | % | Result(P<.05) ------- | ------------ | ----- | ------------ | ----------- | --- | ----- | ------------- Firefox | Overall | 250 | 2821 | 2790 | -32 | -1.12 | faster Firefox | Page Request | 250 | 2 | 2 | 0 | 6.68 | Firefox | Rendering | 250 | 2820 | 2788 | -32 | -1.13 | faster ```
- Loading branch information