Skip to content

Conversation

@michalChrobot
Copy link
Member

Purpose of this PR

As noted in #3808 it seems like we missed forward porting of PR-3227 from develop (NGOv1.X) to develop-2.0.0 (NGOv2.X) branch. This PR does the port

Note that there were no conflicts when cherry-picking the PR but still would be worth double checking.
Also I noticed that with the original PR the changelog description was also missed, something that can be clarified

Jira ticket

N/A

Changelog

  • Changed: Improved performance of NetworkBehaviour ILPostProcessor by omitting unnecessary type and assembly resolutions.

Documentation

  • No documentation changes or additions were necessary.

Testing & QA (How your changes can be verified during release Playtest)

We should do the same check as was done in the original PR (TBD)

Backports

This is a port of #3227

NoelStephensUnity and others added 2 commits December 22, 2025 09:50
User submitted PR: #3224 


## Measurement

With `minimalproject`, I used the following code for measurement.

```diff
diff --git a/com.unity.netcode.gameobjects/Editor/CodeGen/NetworkBehaviourILPP.cs b/com.unity.netcode.gameobjects/Editor/CodeGen/NetworkBehaviourILPP.cs
index 7e95fea..39b4f991 100644
--- a/com.unity.netcode.gameobjects/Editor/CodeGen/NetworkBehaviourILPP.cs
+++ b/com.unity.netcode.gameobjects/Editor/CodeGen/NetworkBehaviourILPP.cs
@@ -77,6 +77,8 @@ namespace Unity.Netcode.Editor.CodeGen
 
             m_Diagnostics.Clear();
 
+            var sw = System.Diagnostics.Stopwatch.StartNew();
+
             // read
             var assemblyDefinition = CodeGenHelpers.AssemblyDefinitionFor(compiledAssembly, out m_AssemblyResolver);
             if (assemblyDefinition == null)
@@ -171,6 +173,8 @@ namespace Unity.Netcode.Editor.CodeGen
 
             assemblyDefinition.Write(pe, writerParameters);
 
+            m_Diagnostics.AddWarning($"ILPP has completed for {compiledAssembly.Name} in {sw.ElapsedMilliseconds} ms");
+
             return new ILPostProcessResult(new InMemoryAssembly(pe.ToArray(), pdb.ToArray()), m_Diagnostics);
         }
 
```

### Before
```
(0,0): warning  - ILPP has completed for Unity.Netcode.Editor in 531 ms
(0,0): warning  - ILPP has completed for Unity.Netcode.EditorTests in 604 ms
(0,0): warning  - ILPP has completed for Unity.Netcode.Components in 363 ms
(0,0): warning  - ILPP has completed for Unity.Netcode.TestHelpers.Runtime in 330 ms
(0,0): warning  - ILPP has completed for Unity.Netcode.RuntimeTests in 735 ms
```

### After
```
(0,0): warning  - ILPP has completed for Unity.Netcode.Editor in 79 ms
(0,0): warning  - ILPP has completed for Unity.Netcode.EditorTests in 128 ms
(0,0): warning  - ILPP has completed for Unity.Netcode.Components in 146 ms
(0,0): warning  - ILPP has completed for Unity.Netcode.TestHelpers.Runtime in 117 ms
(0,0): warning  - ILPP has completed for Unity.Netcode.RuntimeTests in 537 ms
```

## Changelog

- Changed: Improved performance of NetworkBehaviour ILPostProcessor by
omitting unnecessary type and assembly resolutions.

## Testing and Documentation

- No tests have been added.
- No documentation changes or additions were necessary.

---------

Co-authored-by: ruccho <noboroo2000@yahoo.co.jp>
@michalChrobot michalChrobot self-assigned this Dec 22, 2025
@michalChrobot michalChrobot requested a review from a team as a code owner December 22, 2025 08:58
@michalChrobot michalChrobot changed the title [Port] Backport of PR-3227 perf: [Port] Backport of PR-3227 Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants