简体   繁体   中英

Why does the size of my compiled file decrease?

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

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...

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.

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.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM