-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce the number of function calls in the Dict
class
#11169
Reduce the number of function calls in the Dict
class
#11169
Conversation
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/784145e7c9b81de/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/c839327f12b3c77/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/784145e7c9b81de/output.txt Total script time: 17.71 mins
|
From: Bot.io (Windows)FailedFull output at http://54.215.176.217:8877/c839327f12b3c77/output.txt Total script time: 26.06 mins
Image differences available at: http://54.215.176.217:8877/c839327f12b3c77/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/4cbfac6abccc63d/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/8cce603852a189d/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/8cce603852a189d/output.txt Total script time: 17.70 mins
|
From: Bot.io (Windows)FailedFull output at http://54.215.176.217:8877/4cbfac6abccc63d/output.txt Total script time: 26.04 mins
Image differences available at: http://54.215.176.217:8877/4cbfac6abccc63d/reftest-analyzer.html#web=eq.log |
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 ```
4a18b94
to
2cac684
Compare
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/b9e7cc5d90547bc/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/1718c1a461973e8/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/b9e7cc5d90547bc/output.txt Total script time: 17.73 mins
|
From: Bot.io (Windows)FailedFull output at http://54.215.176.217:8877/1718c1a461973e8/output.txt Total script time: 26.20 mins
Image differences available at: http://54.215.176.217:8877/1718c1a461973e8/reftest-analyzer.html#web=eq.log |
Looks good, and also a lot more readable, to me. Thanks! |
The following changes were made:
typeof
checks in theget
/getAsync
methods.get
/getAsync
methods.Ref
checks in theget
/getAsync
/getArray
methods, since it helps avoid many unnecessary functions calls. I.e. this way it's possible to directly callXRef.{fetch, fetchAsync)
only when necessary, rather than always having to callXRef.{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:
This gave the following results when comparing this patch against the
master
branch: