-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Use Math.hypot
, instead of Math.sqrt
with manual squaring
#12973
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
Conversation
6926fb3
to
06c0b4b
Compare
When the PDF.js project started `Math.hypot` didn't exist yet, and until recently we still supported browsers (IE 11) without a native `Math.hypot` implementation; please see this compatibility information: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/hypot#browser_compatibility Furthermore, somewhat recently there were performance improvements of `Math.hypot` in Firefox; see https://bugzilla.mozilla.org/show_bug.cgi?id=1648820 Finally, this patch also replaces a couple of multiplications with the exponentiation operator.
06c0b4b
to
d212c40
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/8073de2c1e52f70/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/8073de2c1e52f70/output.txt Total script time: 22.97 mins
Image differences available at: http://54.67.70.0:8877/8073de2c1e52f70/reftest-analyzer.html#web=eq.log |
/botio-windows test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://3.101.106.178:8877/9c1f2bc020715c0/output.txt |
From: Bot.io (Windows)FailedFull output at http://3.101.106.178:8877/9c1f2bc020715c0/output.txt Total script time: 29.24 mins
Image differences available at: http://3.101.106.178:8877/9c1f2bc020715c0/reftest-analyzer.html#web=eq.log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thanks for doing this.
When the PDF.js project started
Math.hypot
didn't exist yet, and until recently we still supported browsers (IE 11) without a nativeMath.hypot
implementation; please see this compatibility information: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/hypot#browser_compatibilityFurthermore, somewhat recently there were performance improvements of
Math.hypot
in Firefox; see https://bugzilla.mozilla.org/show_bug.cgi?id=1648820Finally, this patch also replaces a couple of multiplications with the exponentiation operator.