Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Performance of blank Start, Update, etc. methods

Discussion in 'Editor & General Support' started by dogfacedesign, Nov 14, 2018.

  1. dogfacedesign

    dogfacedesign

    Joined:
    Jan 10, 2016
    Posts:
    70
    I'm curious on this. If you have thousands of GameObjects with scripts in them, and you have a lot of these stubs in them, wouldn't this invoke unnecessary method calls? Granted, the execution would be super fast since nothing is in them, but I'm thinking in terms of scale, would it be better to just remove them? I haven't run any profiling tests, but I'm curious as to what the general thought is on it.

    Code (CSharp):
    1.         // Use this for initialization
    2.         void Start ()
    3.         {
    4.        
    5.         }
    6.        
    7.         // Update is called once per frame
    8.         void Update ()
    9.         {
    10.        
    11.         }
     
  2. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
  3. dogfacedesign

    dogfacedesign

    Joined:
    Jan 10, 2016
    Posts:
    70
    Excellent link - thanks!
     
  4. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    If performance is a thing for you and you need stubs, check out ECS. It's very stub and component friendly, and the fastest my code has ever been, even when I used to code in C++ (and I was competent enough to release a game in C++ so no slouch there...)
     
  5. dogfacedesign

    dogfacedesign

    Joined:
    Jan 10, 2016
    Posts:
    70
    I don't "need" stubs, per se. I was just curious more than anything. I will definitely check out ECS!