C# vs Unityscript – Which is faster?

C# vs Unityscript – Which is faster?

Nov 20

I set out to find if there are any speed advantages to using C# when programming in Unity. I have for awhile kept both versions of my popular tweening engine LeanTween in C# and Unityscript, because I still thought there might be speed advantages to using Unityscript. This is a lot of work to maintain both versions, so I wanted to test my hypothesis and see whether Unityscript was actually faster. View the video below or read-on to find my results.

The performance breakdown has been performed with a new feature in FPS Graph which gives a breakdown of the performance over a certain amount of time (this new feature will be available in about a week once it gets approved). Below you can see how the performance breakdown looks:

Breakdown of the performance shown with FPS Graph



I ran the LeanTween.js and LeanTween.cs stress test 10 times (lower scores are better) to see which one would win out.

The average of C# is 8,075ms and Unityscript is 8,142ms. So C# is a little bit ahead, but I would say it’s statistically inconclusive….

These results have lead me to decide I will start to migrate to a C# only version of LeanTween (still supporting Javascript, as long as it’s in the Plugin directory). I only pick C# because there are so many people that need it in C# because of unique setups where only C# is supported (some corporate setups with Visual Studio and compiling DLLs).

3 comments

  1. Big spike there in js, any idea why? Overall, c# apears to be more stable.

    • I am not sure, those seem to happen occassionally particularly in the IDE. I wouldn’t really attribute it to it being a JS thing, it just seems to happen from time to time…

  2. Arowx

    Check the profiler I’m guessing it could be the GC kicking in.

Leave a Reply