Performance difference between ?? and IsNull?

2 posts, 0 answers
  1. Anil
    Anil avatar
    5 posts
    Member since:
    Sep 2018

    Posted 08 Nov 2018 Link to this post

    Since the null-coalescing operator (??) and the IsNull function appear to do the same thing, I was wondering if there is a performance benefit of using one over the other.
  2. Ivan Hristov
    Admin
    Ivan Hristov avatar
    206 posts

    Posted 13 Nov 2018 Link to this post

    Hello Anil,

    The null-coalescing operator ?? should perform a bit faster than the IsNull function, because the functions are resolved via method attributes, which involves reflection, while the ?? operator instantiates a new binary function and passes the operands to it. However, I expect the execution time for both to affect the performance by a very small factor, because the resource-consuming tasks are mainly performed during the process of building the processing tree and rendering the document, so it's much to your preference to use one or another.

    Regards,
    Ivan Hristov
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top