Benchmark

January 13, 2016 ยท View on GitHub

How to measure

Benchmark is done with following steps.

  1. Run Unity3D.
  2. Open a target project.
  3. Make unity build scripts by editing one C# source for warming up.
  4. Do previous step again and measure compilation time.
    • Edit a script in Assembly-CSharp (not plugins nor editor)
    • Compilation time is recorded in UniversalCompiler log.

Test environment

  • CPU: Intel Core i5-4690 (3.50 GHz)
  • RAM: 8 GB
  • OS: Windows 10 Pro (64 bits)
  • SSD: Samsung SSD 840 EVO 1TB
  • Unity 5.3.1f1 (Win64)

Target projects

  1. Generated project whose script size is 1.4 MB (sample/Benchmark)
  2. Generated project whose script size is 6.7 MB (sample/Benchmark)
  3. In-house real project whose script size is 9.4 MB

Tested compiler

  1. Unity default compiler (Mono3)
  2. C# 6 roslyn compiler (CSC6)
  3. Incremental C# 6 Compiler with "WhenNoChange" configuration (ICS6)
  4. Incremental C# 6 Compiler with default "WhenNoSourceChange" configuration (ICS6@)

Results

Project 1 (Generated project: 1.4 MB)

This project is generated with SourcePopulate.py 30 20 200 in ./samples/Benchmark.

Project size
ProjectCountSize
Plugins20122,980
Scripts2001,175,260
Editor30181,409
Total2501,479,649
Compilation time (sec)
Mono3CSC6ICS6ICS6@
Scripts2.233.520.950.95
Editor0.602.880.230.17
Total2.836.401.181.12
Total (%)100%226%41%39%

For small size project, it's hard to get significant benefit. 2.83 seconds with Mono3 is not bad for work.

Project 2 (Generated project: 6.7 MB)

This project is generated with SourcePopulate.py 200 20 1000 in ./samples/Benchmark.

Project size
ProjectCountSize
Plugins20122,980
Scripts1,0005,642,460
Editor2001,130,519
Total1,2206,895,959
Compilation time (sec)
Mono3CSC6ICS6ICS6@
Scripts22.824.722.682.68
Editor1.883.080.590.17
Total24.707.803.272.85
Total (%)100%31%13%11%

After getting mono3 result, compilation time seems to be too long. Test was repeated several times to make sure but same result. There should be a corner case for mono compiler.

Project 3 (In-house project: 9.4 MB)

This project is my company project and not allowed to be open. But this is a real project and worth sharing result.

Project size
ProjectCountSize
Plugins10158,858
Scripts1,3777,509,543
Editor2231,967,076
Total1,6109,635,477
Compilation time (sec)
Mono3CSC6ICS6ICS6@
Scripts8.305.673.503.52
Editor2.833.271.100.19
Total11.138.944.603.71
Total (%)100%80%41%33%

This result is first place that I consider to make this incremental compiler. Edit & review workflow doesn't go well with Mono3 compilation time. Everytime source is modified, I always look hard at loading indicator impatiently. But incremental compiler with aggresive WhenNoSourceChange gives a way faster compilation speed and make me happy, still I can feel time fly but bearable.