Search Unity

C# Partial Class Awesomeness: will it impact runtime performance?

Discussion in 'Scripting' started by azeitler, Jul 24, 2011.

  1. azeitler

    azeitler

    Joined:
    May 14, 2008
    Posts:
    162
    Hi folks,

    I recently discovered the awesomeness of using partial classes when working with Unity and trying to maintain any kind of reusable code base.

    As far as I could piece together from various articles on the subject, using partial classes will negatively influence build performance, but should not impact runtime performance at all.

    Can anybody with a more sophisticated .NET/Programming background (or a much higher nerd level as me) confirm and explain to me why that is or is not the case?

    best,
    Andreas
     
  2. npsf3000

    npsf3000

    Joined:
    Sep 19, 2010
    Posts:
    3,830
    After a quick goole partial simple means a class's source code can be split into multiple files.

    Those don't exist when it's compiled - so I'd be shocked if you had any negative performance (compared to same class in one big file).

    I'd be surprised if it had any major compilation delay either... seems to be basic text operations to get it back into a single file :)
     
  3. diablo

    diablo

    Joined:
    Jan 3, 2011
    Posts:
    736
    To answer your question, having a partial class will in no way impact performance.