Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. IL Question

IL Question

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpdotnetdata-structuresquestion
8 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sultan_of_6string
    wrote on last edited by
    #1

    By Microsoft's own admission, the C# compiler is not much of an optimizer. I need to get a particular class working blazing fast, so I'm using ildasm to get the IL, modifying it and ilasm-ing it back to a PE. I need to know what's a faster way to push two references to the current object onto the stack: ldarg.0 ldarg.0 OR ldarg.0 dup Thanks

    S J R 4 Replies Last reply
    0
    • S sultan_of_6string

      By Microsoft's own admission, the C# compiler is not much of an optimizer. I need to get a particular class working blazing fast, so I'm using ildasm to get the IL, modifying it and ilasm-ing it back to a PE. I need to know what's a faster way to push two references to the current object onto the stack: ldarg.0 ldarg.0 OR ldarg.0 dup Thanks

      S Offline
      S Offline
      SimonS
      wrote on last edited by
      #2

      I'm going to ask a dumb question: If you're requiring performance only, why not go for C++ (or even inline C) ? I don't see the benefit of doing IL manually. Cheers, Simon "Every good work of software starts by scratching a developer's personal itch.", Eric S. Raymond

      S 1 Reply Last reply
      0
      • S SimonS

        I'm going to ask a dumb question: If you're requiring performance only, why not go for C++ (or even inline C) ? I don't see the benefit of doing IL manually. Cheers, Simon "Every good work of software starts by scratching a developer's personal itch.", Eric S. Raymond

        S Offline
        S Offline
        sultan_of_6string
        wrote on last edited by
        #3

        After disassembling the Managed C++ code, I realized that I can optimize it better than the compiler. However, the MC++ included some native code which can't be disassembled with ildasm so I can't compile it with ilasm. Besides, since the stuff is managed, it doesn't really matter what language I write in; I like C#.

        A 1 Reply Last reply
        0
        • S sultan_of_6string

          By Microsoft's own admission, the C# compiler is not much of an optimizer. I need to get a particular class working blazing fast, so I'm using ildasm to get the IL, modifying it and ilasm-ing it back to a PE. I need to know what's a faster way to push two references to the current object onto the stack: ldarg.0 ldarg.0 OR ldarg.0 dup Thanks

          J Offline
          J Offline
          Joao Vaz
          wrote on last edited by
          #4

          The 2nd part is faster since dup doesn't need to be verified and it's considered type safe :-) Cheers, Joao Vaz The loved ones never really leave us , they are always alive on our hearts and minds.

          1 Reply Last reply
          0
          • S sultan_of_6string

            By Microsoft's own admission, the C# compiler is not much of an optimizer. I need to get a particular class working blazing fast, so I'm using ildasm to get the IL, modifying it and ilasm-ing it back to a PE. I need to know what's a faster way to push two references to the current object onto the stack: ldarg.0 ldarg.0 OR ldarg.0 dup Thanks

            J Offline
            J Offline
            Joao Vaz
            wrote on last edited by
            #5

            And since you are interested in Il, check the Ecma-335 specificationthat deals with the Commom Language Infrastructure, in which IL instruction set belongs, here Common Language Infrastructure Cheers, Joao Vaz The loved ones never really leave us , they are always alive on our hearts and minds.

            1 Reply Last reply
            0
            • S sultan_of_6string

              After disassembling the Managed C++ code, I realized that I can optimize it better than the compiler. However, the MC++ included some native code which can't be disassembled with ildasm so I can't compile it with ilasm. Besides, since the stuff is managed, it doesn't really matter what language I write in; I like C#.

              A Offline
              A Offline
              Alexandru Savescu
              wrote on last edited by
              #6

              I think it does. Only memmory is managed, but the Managed C++ code is more optimized that C#, actually I think is the only optimized language from .NET. Also with managed you can combine managed and unmanaged code so you can obtain native code for real time actions. Best regards, Alexandru Savescu

              C 1 Reply Last reply
              0
              • A Alexandru Savescu

                I think it does. Only memmory is managed, but the Managed C++ code is more optimized that C#, actually I think is the only optimized language from .NET. Also with managed you can combine managed and unmanaged code so you can obtain native code for real time actions. Best regards, Alexandru Savescu

                C Offline
                C Offline
                Christopher Lord
                wrote on last edited by
                #7

                Could you direct me to where ms says mc++ is more optimized? I cant seem to find reference to that.

                1 Reply Last reply
                0
                • S sultan_of_6string

                  By Microsoft's own admission, the C# compiler is not much of an optimizer. I need to get a particular class working blazing fast, so I'm using ildasm to get the IL, modifying it and ilasm-ing it back to a PE. I need to know what's a faster way to push two references to the current object onto the stack: ldarg.0 ldarg.0 OR ldarg.0 dup Thanks

                  R Offline
                  R Offline
                  Rama Krishna Vavilala
                  wrote on last edited by
                  #8

                  I don't think there will be any observable difference between the two. I will really be surprised if your hand optimization gives you more speed than the unoptimized code. I have never wasted time worrying about such insignificant things. Keep your eye upon the donut and NOT upon the hole. - Bill Sergio about posting in the right forum. The Lounge - June 23, 2002

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups