-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Change 'lookUpwardForInlineStyle' from O(n^2) to O(n). #1429
Change 'lookUpwardForInlineStyle' from O(n^2) to O(n). #1429
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
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.
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.
@flarnie is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
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.
@flarnie has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: **Summary** The function 'lookUpwardForInlineStyle' repeatedly called 'getPreviousBlock' which has the complexity O(n). This tanks performance when creating a document with lots of empty lines. Simply holding down the enter key will quickly cause the frame rate to drop below 1fps. The fix is straightforward and, in my opinion, preferable to a while loop. **Test Plan** I did some manual testing. The code was able to correctly (and efficiently) find the correct style. Closes facebookarchive/draft-js#1429 Differential Revision: D6060417 fbshipit-source-id: 8a14af25f776ac5263747e2fc4bbb665884ad970
Summary: **Summary** The function 'lookUpwardForInlineStyle' repeatedly called 'getPreviousBlock' which has the complexity O(n). This tanks performance when creating a document with lots of empty lines. Simply holding down the enter key will quickly cause the frame rate to drop below 1fps. The fix is straightforward and, in my opinion, preferable to a while loop. **Test Plan** I did some manual testing. The code was able to correctly (and efficiently) find the correct style. Closes facebookarchive/draft-js#1429 Differential Revision: D6060417 fbshipit-source-id: 8a14af25f776ac5263747e2fc4bbb665884ad970
Summary: **Summary** The function 'lookUpwardForInlineStyle' repeatedly called 'getPreviousBlock' which has the complexity O(n). This tanks performance when creating a document with lots of empty lines. Simply holding down the enter key will quickly cause the frame rate to drop below 1fps. The fix is straightforward and, in my opinion, preferable to a while loop. **Test Plan** I did some manual testing. The code was able to correctly (and efficiently) find the correct style. Closes facebookarchive/draft-js#1429 Differential Revision: D6060417 fbshipit-source-id: 8a14af25f776ac5263747e2fc4bbb665884ad970
Summary
The function 'lookUpwardForInlineStyle' repeatedly called 'getPreviousBlock' which has the complexity O(n). This tanks performance when creating a document with lots of empty lines. Simply holding down the enter key will quickly cause the frame rate to drop below 1fps.
The fix is straightforward and, in my opinion, preferable to a while loop.
Test Plan
I did some manual testing. The code was able to correctly (and efficiently) find the correct style.