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 8253635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:56:37+00:00 2026-06-08T00:56:37+00:00

Which of the following gives better performance: DynamicMethod dm = …. .. //create IL

  • 0

Which of the following gives better performance:

DynamicMethod dm = ....
..
//create IL for 'dm'
//store 'dm' for later use
..
..
later
..
..
dm.Invoke(..);

OR

DynamicMethod dm;
Delegate del = dm.CreateDelegate()
// store 'del' for later use
..
..
later
..
..
del(..);

Note that typically 10s or 100s of different DynamicMethods will be created and each DynamicMethod (via hashtable of stored ‘dm’s or ‘del’s) will be called multiple times.

  • 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-08T00:56:39+00:00Added an answer on June 8, 2026 at 12:56 am

    If you are just creating ‘throw away’ methods (iow not using them again), it does not matter.

    If you however reuse them, the second option will be significantly faster.

    Update:

    The first option uses reflection only (RuntimeMethodHandle.InvokeMethodFast(...)). I will assume that internally, the DynamicMethod will be compiled at some stage too, which will incur some additional overhead on the first call and possibly additional calls.

    The second option, the DynamicMethod is explicitly compiled to a known delegate type. As everyone should know, ‘direct’ delegate calls are almost as fast as a ‘direct’ method call.

    Opinion:

    Always use the second option, even when just using them once. You will have some compile time benefits additionally to the massive performance increase.

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

Sidebar

Related Questions

I have the following query which gives me the right results. But it's super
I´m executing the following command grep bruno < bash.txt which gives me the right
I use JEditable for making edit field which following code: $(function() { $(.field).editable(http://localhost/index.php/welcome/update_record, {
I use the following which works perfectly in all browsers, except ie9 $result =
I created the follwing table which gives the user option to uses check boxes
Given the following lines of code which is using JQTOUCH: $('#customers').bind('pageAnimationEnd', function(e, info){ if
I have the following code which is fine if I give invalid parameters (though,
I want to Make selenium script which move slider given on following site Example
I have the following regular expression which is used to give me the tags
I tried the following, all of which fail on function ScrollIntoView and give a

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.