473,320 Members | 1,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

IL waste of time

Simple vb code:

<STAThread_
Public Shared Sub Main()
Dim g As Integer = 3
Console.WriteLine(g)
End Sub
avaluates to:

..method public static void Main() cil managed
{
.custom instance void [mscorlib]System.STAThreadAttribute::.ctor()
.entrypoint
.maxstack 1
.locals init (
[0] int32 g)
L_0000: ldc.i4.3
L_0001: stloc.0
L_0002: ldloc.0
L_0003: call void [mscorlib]System.Console::WriteLine(int32)
L_0008: ret
}

Look at lines 00 to 02
Load to eval stack
load off from the stack
load back to the eval stack

This code was generated with vb.net 2.0 in release mode with
optimizations enabled.

What is the meaning of this? Why is this done when it seams to by a
waste of pc power only?

Sep 6 '07 #1
5 1575
Doker <do****@wp.plwrote:

<snip>
This code was generated with vb.net 2.0 in release mode with
optimizations enabled.

What is the meaning of this? Why is this done when it seams to by a
waste of pc power only?
It means the debugger can still show what's going on. The code is a
direct translation of what the source code shows.

What it will turn into when JIT-compiled (with optimisations on
*there*) is a different matter.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Sep 6 '07 #2
Jon Skeet [C# MVP] pisze:
Doker <do****@wp.plwrote:

<snip>
>This code was generated with vb.net 2.0 in release mode with
optimizations enabled.

What is the meaning of this? Why is this done when it seams to by a
waste of pc power only?

It means the debugger can still show what's going on. The code is a
direct translation of what the source code shows.
Why would I want it to show ANYTHING when i build a release, in the
first place? ;>
Sep 7 '07 #3
Doker <do****@wp.plwrote:
It means the debugger can still show what's going on. The code is a
direct translation of what the source code shows.

Why would I want it to show ANYTHING when i build a release, in the
first place? ;>
Optimised doesn't necessarily mean "don't produce debug information".
More to the point, why do you care? If the JIT optimisations mean
there's no cost, why would we want the C# compiler team to waste time
performing the optimisation earlier?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Sep 7 '07 #4
Jon Skeet [C# MVP] pisze:
Doker <do****@wp.plwrote:
>>It means the debugger can still show what's going on. The code is a
direct translation of what the source code shows.
Why would I want it to show ANYTHING when i build a release, in the
first place? ;>

Optimised doesn't necessarily mean "don't produce debug information".
More to the point, why do you care? If the JIT optimisations mean
there's no cost, why would we want the C# compiler team to waste time
performing the optimisation earlier?
To put less optimization to JIT - reduce time to run app
Not to thing does JIT Compiler does it or doesn't
Make app harder to decompile
See it's a good work and not waste time having doubts and asking here.
Have a feeling c# compiler is a compiler not a simple c# to stack
machine translator any child can make.
And more.
Sep 8 '07 #5
Doker <do****@wp.plwrote:
Optimised doesn't necessarily mean "don't produce debug information".
More to the point, why do you care? If the JIT optimisations mean
there's no cost, why would we want the C# compiler team to waste time
performing the optimisation earlier?

To put less optimization to JIT - reduce time to run app
But at the same time making debugging harder
Not to thing does JIT Compiler does it or doesn't
Not sure what you mean here.
Make app harder to decompile
Not significantly, IMO.
See it's a good work and not waste time having doubts and asking here.
Have a feeling c# compiler is a compiler not a simple c# to stack
machine translator any child can make.
And more.
The C# compiler for version 1 was relatively simple - as of v2 (and
particularly v3) it does a lot more for you. I don't see optimisation
as particularly important at the C# -IL level. There have been
examples where the C++/CLI compiler can produce IL which runs
significantly quicker than the C# code, but my suspicions is that
that's the exception rather than the norm. (It may always produce
faster code - it's the "significantly" part I have doubts about.)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Sep 8 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: salad | last post by:
Thanks for reading this post and wasting your time. I was thinking about writing about the PCDatasheet vs The Pussyfarts war. The pussyfarts, as near as I can tell, have little to offer this...
24
by: asincero | last post by:
Would it be considered good form to begin every method or function with a bunch of asserts checking to see if the parameters are of the correct type (in addition to seeing if they meet other kinds...
9
by: FFMG | last post by:
In my site I have a config table, (MySQL), with about 30 entries; the data is loaded on every single page load. This is not the only call to the db, (we do a total of about 8 calls to the db). As...
6
by: llothar | last post by:
While 90% of my application is written in Eiffel i have a few modules that are in C and i'm still gettings crashs from time to time. Not sure where it comes from but i thought about using lint as...
2
by: Cindy Lee | last post by:
Wow, I can't believe they're trying to do this garbage. If I wanted to do complicated MVC and unit testing, I'd go back to Java. Bottom line is people that are doing this are cocky developers...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.