views:

99

answers:

4

i did some modification on my project windowservice. Previously it was 56kb. But after modification its size decreased to 54kb.Actually modification increased number of coding,then why size is decreasing, Any idea about this feature

A: 

If you're looking at the size of the executable, then it's because the size of the meta information changed.

If you're looking at the in-memory size like with TaskMgr, then it's probably because it's executing a little differently due to runtime history.

wallyk
my question is why size decreasing
peter
A: 

Not necessary mata info. Section alignment has probably change (of course this include meta). Check section sizes using DUMPBIN command, for compare old and new executable.

It can be inline optimizion. If compiler choise that this method is too big for inline optimizion it won't be copy code every calling places. This will decrease filesize.

VC uses 512 bytes to round executable. So dropping one string off can reduce file size 512 bytes (if you are lucky).

Tuukka
my question is why size decreasing
peter
+2  A: 

There is no obvious correlation between lines of C# code and the IL that's generated for them. Especially anonymous methods, lambdas, iterators and Linq queries can be very compact in C# but generate a lot of IL. You'd have to use ildasm.exe to get to the bottom of it. If you'd really want to find out...

Hans Passant
my question is why size decreasing
peter
Because you used less of those expensive constructs? I don't know, you forgot to say what you changed.
Hans Passant
i am sending some attributes which contain some string value from a service which has installer class and can see in services.msc to another windowservice which doesnt have installer class and is called internally by another serverservice which has installer class
peter
Peter, the point nobugz is making, is that you might have removed two lines of code that resolved to ten lines of IL, while adding five lines of code that resolved to five lines of IL, resulting in a net reduction in file size. Evaluate the IL before and after the change to find out.
Michael Petrotta
No i didnt removed any single line of code thats what the interesting thing
peter
What did you learn from the IL comparison?
Michael Petrotta
+2  A: 

The changes you made in your source code are generating smaller machine code by their nature, or a compile time option could have been changed.

Or, the filesystem could be aligning the file based on the number of blocks it takes up.

Shawn B