- Home /
Performance cost in code
Hey guys, Ive been messing around in Unity for almost 5 years now, but for all that time ive yet to find some place where i can see accurate data of how much costly in performance some codes are.
For example: I have a Raycast, that updates every time a Linecast is hit, which updates every frame - What takes more performance?
Its stuff like this that i need to know, because in some parts of my projects i see big spikes, but i dont know the origin of them.
Is there any site, or unity page that gives out the performance statistics for at least SOME codes?
-Cheers
In the profiler you can choose the option "Deep profile", with that you should atleast see what script is causing the performance spike.
Unity gems has a good article on benchmarking.
The reason none of this is in the docs is because a lot is dependent on hardware configuration. Different code will actually preform differently with different processers and graphics code.
Unity $$anonymous$$anual do have certain tips for you on Optimizing Script Performance
It does not even scratch the surface but have one or two tips.
$$anonymous$$ostly they are concerned about GC. There is whole page for Understanding Automatic $$anonymous$$emory $$anonymous$$anagement
Your answer
![](https://koobas.hobune.stream/wayback/20220613160125im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Ref modifier 1 Answer
Animation Reset 1 Answer
Creating Unity Statistics Plugin 0 Answers
Console Error 1 Answer