Skip to content

Commit

Permalink
[coreanimation] Reduce the size of CATransform3D (#11810)
Browse files Browse the repository at this point in the history
by avoiding casting every value set to create the `Identity` field.

**Before**

```cil
	IL_0000: ldsflda valuetype CoreAnimation.CATransform3D CoreAnimation.CATransform3D::Identity
	IL_0005: initobj CoreAnimation.CATransform3D
	IL_000b: ldsflda valuetype CoreAnimation.CATransform3D CoreAnimation.CATransform3D::Identity
	IL_0010: ldc.r4 1
	IL_0015: call valuetype System.nfloat System.nfloat::op_Implicit(float32)
	IL_001a: stfld valuetype System.nfloat CoreAnimation.CATransform3D::m11
	IL_001f: ldsflda valuetype CoreAnimation.CATransform3D CoreAnimation.CATransform3D::Identity
	IL_0024: ldc.r4 1
	IL_0029: call valuetype System.nfloat System.nfloat::op_Implicit(float32)
	IL_002e: stfld valuetype System.nfloat CoreAnimation.CATransform3D::m22
	IL_0033: ldsflda valuetype CoreAnimation.CATransform3D CoreAnimation.CATransform3D::Identity
	IL_0038: ldc.r4 1
	IL_003d: call valuetype System.nfloat System.nfloat::op_Implicit(float32)
	IL_0042: stfld valuetype System.nfloat CoreAnimation.CATransform3D::m33
	IL_0047: ldsflda valuetype CoreAnimation.CATransform3D CoreAnimation.CATransform3D::Identity
	IL_004c: ldc.r4 1
	IL_0051: call valuetype System.nfloat System.nfloat::op_Implicit(float32)
	IL_0056: stfld valuetype System.nfloat CoreAnimation.CATransform3D::m44
	IL_005b: ret
```

**After**

```cil
	IL_0000: ldsflda valuetype CoreAnimation.CATransform3D CoreAnimation.CATransform3D::Identity
	IL_0005: initobj CoreAnimation.CATransform3D
	IL_000b: ldsflda valuetype CoreAnimation.CATransform3D CoreAnimation.CATransform3D::Identity
	IL_0010: ldsflda valuetype CoreAnimation.CATransform3D CoreAnimation.CATransform3D::Identity
	IL_0015: ldsflda valuetype CoreAnimation.CATransform3D CoreAnimation.CATransform3D::Identity
	IL_001a: ldsflda valuetype CoreAnimation.CATransform3D CoreAnimation.CATransform3D::Identity
	IL_001f: ldc.r4 1
	IL_0024: call valuetype System.nfloat System.nfloat::op_Implicit(float32)
	IL_0029: dup
	IL_002a: stloc.0
	IL_002b: stfld valuetype System.nfloat CoreAnimation.CATransform3D::m44
	IL_0030: ldloc.0
	IL_0031: dup
	IL_0032: stloc.0
	IL_0033: stfld valuetype System.nfloat CoreAnimation.CATransform3D::m33
	IL_0038: ldloc.0
	IL_0039: dup
	IL_003a: stloc.0
	IL_003b: stfld valuetype System.nfloat CoreAnimation.CATransform3D::m22
	IL_0040: ldloc.0
	IL_0041: stfld valuetype System.nfloat CoreAnimation.CATransform3D::m11
	IL_0046: ret
```
  • Loading branch information
spouliot authored Jun 4, 2021
1 parent 0de6274 commit 98b6a1f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/CoreAnimation/CATransform3D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ public struct CATransform3D {
static CATransform3D ()
{
Identity = new CATransform3D ();
Identity.m11 = 1f;
Identity.m22 = 1f;
Identity.m33 = 1f;
Identity.m44 = 1f;
Identity.m11 = Identity.m22 = Identity.m33 = Identity.m44 = 1f;
}

[DllImport(Constants.QuartzLibrary)]
Expand Down

7 comments on commit 98b6a1f

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ [CI Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

API Diff (from PR only) (no change)
Generator Diff (no change)

Packages generated

View packages

Test results

3 tests failed, 218 tests passed.

Failed tests

  • monotouch-test/watchOS 32-bits - simulator/Debug: TimedOut
  • fsharp/watchOS 32-bits - simulator/Debug: TimedOut
  • framework-test/watchOS 32-bits - simulator/Debug: TimedOut

Pipeline on Agent XAMBOT-1027.BigSur'
[coreanimation] Reduce the size of CATransform3D (#11810)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Tests were not ran (VSTS: device tests tvOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[coreanimation] Reduce the size of CATransform3D (#11810)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Tests failed on macOS Mac Catalina (10.15) ❌

Tests failed on Mac Catalina (10.15).

Failed tests are:

  • introspection

Pipeline on Agent
[coreanimation] Reduce the size of CATransform3D (#11810)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Tests failed on macOS Mac Mojave (10.14) ❌

Tests failed on Mac Mojave (10.14).

Failed tests are:

  • introspection

Pipeline on Agent
[coreanimation] Reduce the size of CATransform3D (#11810)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Tests failed on macOS Mac High Sierra (10.13) ❌

Tests failed on Mac High Sierra (10.13).

Failed tests are:

  • introspection

Pipeline on Agent
[coreanimation] Reduce the size of CATransform3D (#11810)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Tests were not ran (VSTS: device tests iOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[coreanimation] Reduce the size of CATransform3D (#11810)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Tests were not ran (VSTS: device tests iOS32b). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[coreanimation] Reduce the size of CATransform3D (#11810)

Please sign in to comment.