Delegate (.NET) - Performance

Performance

Performance of delegates used to be much slower than a virtual or interface method call (6 to 8 times slower in Microsoft's 2003 benchmarks), but, since the .NET 2.0 CLR in 2005, it is about the same as interface calls. This means there is a small added overhead compared to direct method invocations.

There are very stringent rules on the construction of delegate classes. These rules permit optimizing compilers a great deal of leeway when optimizing delegates while ensuring type safety.

Delegates are a variation of closures.

Read more about this topic:  Delegate (.NET)

Famous quotes containing the word performance:

    “Having an identity at work separate from an identity at home means that the work role can help absorb some of the emotional shock of domestic distress. Even a mediocre performance at the office can help a person repair self-esteem damaged in domestic battles.”
    —Faye J. Crosby (20th century)

    “The value of old age depends upon the person who reaches it. To some men of early performance it is useless. To others, who are late to develop, it just enables them to finish the job.”
    —Thomas Hardy (1840–1928)

    “Kind are her answers,
    But her performance keeps no day;
    Breaks time, as dancers,
    From their own music when they stray.”
    —Thomas Campion (1567–1620)