Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8802073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:59:45+00:00 2026-06-14T00:59:45+00:00

What is the performance cost of using dynamic vs object in .NET? Say for

  • 0

What is the performance cost of using dynamic vs object in .NET?

Say for example I have a method which accepts a parameter of any type. E.G.

public void Foo(object obj)
{
}

or

public void Foo(dynamic obj)
{
}

ILSpy tells me that when using dynamic code, the compiler must insert a code block to handle dynamism. Therefore I want to know if using dynamic in place of object is advised and to what level this usage comes at the cost of performance?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:59:46+00:00Added an answer on June 14, 2026 at 12:59 am

    That would depend a lot on the exact scenario – but there is a layer of caching built in, so it is not as terrible as you might expect (it doesn’t do reflection every time). It can also vary on the operations (for example, “lifted” nullable-T operations are noticeably slower). You would need to measure, but as it happens I have some timings here for member (property) access, that I took when doing FastMember:

    Static C#: 14ms
    Dynamic C#: 268ms
    PropertyInfo: 8879ms (aka reflection)
    PropertyDescriptor: 12847ms (aka data-binding)
    TypeAccessor.Create: 73ms (aka FastMember)
    ObjectAccessor.Create: 92ms (aka FastMember)
    

    CAVEAT: these are for a single test that may not be representative of your scenario. This code is shown here

    So: based on a simple test, about 20-times slower than static regular C#, but about 30 times faster than reflection.

    UPDATE: interesting, looks like reflection got faster in .NET 4.5:

    Static C#: 13ms
    Dynamic C#: 249ms
    PropertyInfo: 2991ms
    PropertyDescriptor: 6761ms
    TypeAccessor.Create: 77ms
    ObjectAccessor.Create: 94ms
    

    Here it is only about 12 times faster than reflection, because reflection got faster (not because dynamic got slower).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the relative performance cost of calling a method over in-line code?
Performance issue, when generating around 800~ options from jSon object via javascript. Any suggestion,
In C# what is the performance cost of using the new keyword? I ask
We are using a validation framework (something we have cooked up ourselves) which allows
I'm wondering if there is any particular performance advantage in using LIKE over NOT
What, if any are the performance (or other) implications of creating a new .NET
I have an asp.net-mvc site and I am using LinFu to do IOC. I
I'm trying to optimize query performance and have had to resort to using optimizer
I have a std::list which I am currently randomizing using a Fisher-Yates shuffle (see
This is really a few questions in one, I'm wondering what the performance cost

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.