Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 700
  • Last Modified:

Advantages/Disadvantages of Pre-Compiling

I have a client that has recently asked the following question: "both the aspx & vb files are in the production directory.  Is the site not compiled?  If not, is there a reason?"

I have always been taught that in .net 2.0 and above the site will compile itself on first load and that there is no real advantage anymore to compile the code into a dll.  I've also always been taught that having a compiled site requires a lot more overhead as each time a change is made the site has to be recompiled.

I want to be able to answer this clients question accurately.  Any suggestions on what the main points of my argument against compiling could/should be?
0
davidcahan
Asked:
davidcahan
  • 5
  • 3
  • 2
  • +1
3 Solutions
 
ChetOS82Commented:
The aspx and vb files are compiled automatically on the first request to the application.  The compiled DLL files are cached until a change is made to any of the files.

Pre-compiling the code only provides better preformance on the first hit.

Personally, if I change a page on my site, I go to the site so that I am the one who takes that hit.  All other requests are made against the compiled code.

The only time I deploy a DLL is when I don't want the source code made available to our clients.
0
 
TechTiger007Commented:
You have answered your own question
If you compile the code in asp.net 2.0 the only advantage would be that the logic in code behind will not be visible to any one. Other than this there is no difference.

0
 
TechTiger007Commented:
it is not only the first visit that will compile the code.
Your code will be compiled on the first visit after
1. You restart machine
2. Restart IIS
3. IIS worker process goes down and starts next time
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ChetOS82Commented:
I have never heard of these causing a re-compile:
1. You restart machine
2. Restart IIS
3. IIS worker process goes down and starts next time

Could you cite a reference regarding these?  In fact, I just restarted IIS on a test machine, and then reloaded the ASP.net site and there was no compilation delay.
0
 
davidcahanAuthor Commented:
TechTiger007 i

if there is no advantage other than code security what are the disadvantages?  I'm more concerned with being able to enumerate those to the client.
0
 
TechTiger007Commented:
This is not a disadvantage, only thing is that you have to build the source manually and copy the dll to the site (as we do in old asp.net 1.0/1.1)

If you copy code, asp.net will build the dll for you
In other case you will build the code create a dll and copy into the directory

Once this is done, the rest of execution is same
0
 
davidcahanAuthor Commented:
I may not have been clear enough in what I was asking.  

By "pre-compile" I meant compile the site down to a dll and then just that dll sits in my production environment.    No .aspx or .vb files

Also, I do believe that I may not completely understand the process and that it may not be possible, or a widely accepted methodology, to do what I am saying above.  Then again, I could swear that you could compile down to a dll and run your production site off of that dll.  And that by doing this, your source code is protected because the only thing up there is a compiled dll.   I was also under the impression that if you go with that route their are some major disadvantages.  One being, that each time you change anything you have to re compile the entire project again.  There are other cons also and that was what i was hoping to understand further.
0
 
Tony McCreathTechnical SEO ConsultantCommented:
One advantage of pre-compiling is that you will find all syntax related bugs without having to do a full test of the system.

The disadvantage is the turn around time for making alterations.

I think asp.net has made a good compromise. You can do a full compile to validate syntax AND you can do quick changes while developing.


0
 
TechTiger007Commented:
Other than
1. Source code safety
2. Faster access on first hit on the site
3. Maintainability of site
I dont find any other pros/cons between two approaches.
My suggestion is
If you want your site to be easily maintainable go with copying source files
If you want your code secured go with precompiled version.
0
 
ChetOS82Commented:
TechTiger007: I read the links you posted, they are pretty clear that the site is only *compiled* once (even if the machine is rebooted, etc).  The code needs to be JITed any time the worker process starts, but that hit has nothing to do with pre-compiling (it would occur even if he uploaded a dll).

The only time I upload a DLL is when I don't want someone to have access to read/modify the website.  For me, it is not worth the hassle otherwise.

It is always recommended that you run the site on a test server (which can be your development machine) before you deploy the site, doing this would catch compile-time errors.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now