-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Improve performance of shared/utils.js::intersect (bug 1135277) #14784
Conversation
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/2720d3a4b27359c/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.193.163.58:8877/53d3b527f45c211/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/2720d3a4b27359c/output.txt Total script time: 25.29 mins
Image differences available at: http://54.241.84.105:8877/2720d3a4b27359c/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)SuccessFull output at http://54.193.163.58:8877/53d3b527f45c211/output.txt Total script time: 26.60 mins
|
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.
r=me, since in addition to this being more efficient (fewer function calls and allocations) it's also shorter and easier to understand; thank you!
src/shared/util.js
Outdated
// [a, b] inter [c d] != 0 <=> c <= b && d >= a | ||
// [a, b] inter [c d] = [max(a, c), min(b, d)] with max <= min. |
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.
It might just be a question about the formatting here, but I'm sorry to say that I'm actually finding this comment slightly less clear than just carefully reading the code directly :-)
- avoid to call normalizeRect which clones the rectangles: it's useless and time consuming; - in profiling the pdf in bug 1135277, the time spent in intersect drops from ~1s to ~30ms.
and time consuming;
from ~1s to ~30ms.