perf: faster view layout handling#8255
Conversation
For now this PR only checks for auto in width or height. This is clearly not enough.
But the idea is to check if it is necessary to requestLayout on the parent. Most of the times it is not necessary.
In the case of a complex app the improvements is huge!. It makes apps using animations (not using {N} animation system which is too limited) far more snappier.
This is only a POC!
…mprovements # Conflicts: # tns-core-modules/ui/core/view/view.android.ts # tns-core-modules/ui/gestures/gestures.ios.ts
…into layout_improvements
| } | ||
|
|
||
| public requestLayout(): void { | ||
| public requestLayout(calledFromChild?:boolean): void { |
There was a problem hiding this comment.
Space is needed after the colon in parameter to match the tslint rules
| public requestLayout(calledFromChild?:boolean): void { | |
| public requestLayout(calledFromChild?: boolean): void { |
| super.requestLayout(); | ||
| if (this.nativeViewProtected) { | ||
| this.nativeViewProtected.requestLayout(); | ||
| public requestLayout(calledFromChild?:boolean): void { |
There was a problem hiding this comment.
Space is needed after the colon in parameter to match the tslint rules
| public requestLayout(calledFromChild?:boolean): void { | |
| public requestLayout(calledFromChild?: boolean): void { |
|
|
||
| public requestLayout(): void { | ||
| super.requestLayout(); | ||
| public requestLayout(calledFromChild?:boolean): void { |
There was a problem hiding this comment.
Space is needed after the colon in parameter to match the tslint rules
| public requestLayout(calledFromChild?:boolean): void { | |
| public requestLayout(calledFromChild?: boolean): void { |
| if (this._isLayoutValid) { | ||
| return; | ||
| } | ||
| const width = this.getMeasuredWidth() |
There was a problem hiding this comment.
Missing semicolon
| const width = this.getMeasuredWidth() | |
| const width = this.getMeasuredWidth(); |
| return; | ||
| } | ||
| const width = this.getMeasuredWidth() | ||
| const height = this.getMeasuredHeight() |
There was a problem hiding this comment.
Missing semicolon
| const height = this.getMeasuredHeight() | |
| const height = this.getMeasuredHeight() |
| public isPlaying: boolean; | ||
| // Warning: (ae-forgotten-export) The symbol "AnimationPromise" needs to be exported by the entry point index.d.ts | ||
| // | ||
| // |
There was a problem hiding this comment.
Can you remove all these spaces?
| * Invalidates the layout of the view and triggers a new layout pass. | ||
| */ | ||
| public requestLayout(): void; | ||
| public requestLayout(calledFromChild?:boolean): void; |
There was a problem hiding this comment.
Space is needed after the colon in parameter to match the tslint rules
| public requestLayout(calledFromChild?:boolean): void; | |
| public requestLayout(calledFromChild?: boolean): void; |
|
@vtrifonov sorry about that :s All lint errors fixed |
|
@farfromrefug, sorry, it should remain: public requestLayout(calledFromChild?:boolean): void;(without space after the parameter) in the api-reports/NativeScript.api.json file. You'd better run and then commit the api-reports/NativeScript.api.json file. |
Update NativeScript.api.md
My bad thought it was an error on my side :s |
…into layout_improvements
…yout_improvements # Conflicts: # nativescript-core/ui/core/view-base/view-base.ts
This comment was marked as abuse.
This comment was marked as abuse.
|
@NathanaelA I honestly don't want to talk in time. More in unecessery deep calls..and in some cases those calls are long. But obviously there s time gain from this, not easy to compute though. |
|
@farfromrefug flagging for 7.0 as we can test these changes with all other planned changes for 7.0 👍 |
|
@NathanWalker this PR mostly exists to show the possible issues we have we layout |
8753605 to
86395da
Compare
d4ced42 to
53488b5
Compare
|
@farfromrefug we would like to get some of these improvements in for 8.0 and curious if you would want to collaborate on anything remaining here? |
|
I am willing but it requires a lot of thinking. Upon deeper look at the iOS implementation it has a very deep flow. A view cannot request it s own relayout. It has to go all the way up to the view controller. We need to looknif this is fixable. Otherwise this PR should be discarded (hopefully not) |


reponed #7996 as draft
Related to this issue #7988
For now this PR only checks for auto in width or height. This is clearly not enough.
But the idea is to check if it is necessary to requestLayout on the parent. Most of the times it is not necessary.
In the case of a complex app the improvements is huge!. It makes apps using animations (not using {N} animation system which is too limited) far more snappier.
This is only a POC!