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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:34:13+00:00 2026-06-03T07:34:13+00:00

Does such feature exist? Something like Java HotSpot running in server mode, but for

  • 0

Does such feature exist? Something like Java HotSpot running in server mode, but for .Net applications.

EDIT:
Little more information. I have small application (written in F#) and I have lots of small functions in it. Like this one:

let printable b =
    if b >= ' 'B && b <= '~'B
    then b else '.'B

I had realized that performance in poor, and after profiling I saw that every such function were called millions times. I made them inline and got performance boost (5+ times, may be more).

Ok, nice. Performance is good now. But why didn’t the framework do it? It has enough information about my code and how often a function was called. Why didn’t it inline an function that was called 1M times?

EDIT2:
Sample test to measure difference of an inlined function:

    open System

    let printableByte b =
        if b >= ' 'B && b <= '~'B
        then b else '.'B

    let foo (arr : byte[]) = 
        for i in 0..arr.Length-1 do
            arr.[i] <- printableByte (arr.[i])
        arr.Length / 1000

    let main() =
        let sum = ref 0
        let arr = Array.create 1000000 0uy

        let stopWatch = System.Diagnostics.Stopwatch()
        stopWatch.Start()
        for x in 0..5000 do
            sum := !sum + (foo arr)

        stopWatch.Stop()
        printfn "%d" !sum 
        printfn "total time = %A" stopWatch.ElapsedMilliseconds
        ()

    main()

It runs 19.5 sec when printableByte is not inlined and 13.6 sec when inlined.

EDIT3:
This time difference can be viewed only if compiled for x86 target and run on x64 host. There is no time difference if compiled for “anycpu” or x64.

So, there is no any issue with “small functions” and optimization.

  • 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-03T07:34:14+00:00Added an answer on June 3, 2026 at 7:34 am

    Yes, the CLR does some run-time optimization, as this blog shows.
    Note that according to this post, virtual method are not inlined.

    neither of these methods was inlined:

    • Recursive method
    • Virtual method (even if the static type of the receiver variable is sealed)

    How is your printable function called in your code? If the F# compiler wraps it in a closure, which it often does, even in cases where you might not expect it at first, then you’ll fall into the “virtual method” case.

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

Sidebar

Related Questions

Does such function exist? I created my own but would like to use an
Does such a thing exist anywhere? Basically I see java has LinkedHashSet but no
Why does the new operator exist in modern languages such as C# and Java?
Does such scheme exist? If yes, where can I find it?
Does such an encoder exist? The GDI+ one is not very fully featured. For
What's the date literal for JSON/JavaScript ( if such thing does exists? )
Does anyone know where i can find such a AMI? Oracle database Enterprise Edition
Does anyone have any advice how to write such app? Or maybe knows some
Does anybody know of a way to create a DataSet such that when I
Does anyone know about any API's, IDE's or such that simplifies the development of

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.