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:

    Nobody can misunderstand a boy like his own mother.... Mothers at present can bring children into the world, but this performance is apt to mark the end of their capacities. They can’t even attend to the elementary animal requirements of their offspring. It is quite surprising how many children survive in spite of their mothers.
    Norman Douglas (1868–1952)

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

    To vote is like the payment of a debt—a duty never to be neglected, if its performance is possible.
    Rutherford Birchard Hayes (1822–1893)