Content-Length: 283086 | pFad | http://github.com/NativeScript/NativeScript/pull/10602/files

E7 perf(core): Avoid setting the same value to view properties by CatchABus · Pull Request #10602 · NativeScript/NativeScript · GitHub
Skip to content
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

perf(core): Avoid setting the same value to view properties #10602

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 26 additions & 9 deletions packages/core/ui/styling/style-scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -721,25 +721,40 @@ export class CssState {
cssExpsProperties[property] = value;
continue;
}
delete oldProperties[property];
if (property in oldProperties && oldProperties[property] === value) {
// Skip unchanged values
continue;

if (property in oldProperties) {
const oldValue = oldProperties[property];

delete oldProperties[property];

if (oldValue === value) {
// Skip unchanged values
continue;
}
}

if (isCssVariable(property)) {
view.style.setScopedCssVariable(property, value);
delete newPropertyValues[property];
continue;
}

valuesToApply[property] = value;
}
//we need to parse CSS vars first before evaluating css expressions

// we need to parse CSS vars first before evaluating css expressions
for (const property in cssExpsProperties) {
delete oldProperties[property];
const value = evaluateCssExpressions(view, property, cssExpsProperties[property]);
if (property in oldProperties && oldProperties[property] === value) {
// Skip unchanged values
continue;

if (property in oldProperties) {
const oldValue = oldProperties[property];

delete oldProperties[property];

if (oldValue === value) {
// Skip unchanged values
continue;
}
}
if (value === unsetValue) {
delete newPropertyValues[property];
Expand All @@ -761,9 +776,11 @@ export class CssState {
view[camelCasedProperty] = unsetValue;
}
}

// Set new values to the style
for (const property in valuesToApply) {
const value = valuesToApply[property];

try {
if (property in view.style) {
view.style[`css:${property}`] = value;
Expand Down
Loading








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/NativeScript/NativeScript/pull/10602/files

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy