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:

    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)

    Still be kind,
    And eke out our performance with your mind.
    William Shakespeare (1564–1616)

    There are people who think that wrestling is an ignoble sport. Wrestling is not sport, it is a spectacle, and it is no more ignoble to attend a wrestled performance of suffering than a performance of the sorrows of Arnolphe or Andromaque.
    Roland Barthes (1915–1980)