Solved

Advantages/Disadvantages of Pre-Compiling

Posted on 2008-10-22
11
689 Views
Last Modified: 2012-05-05
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
Comment
Question by:davidcahan
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 18

Accepted Solution

by:
ChetOS82 earned 200 total points
ID: 22779713
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
 
LVL 13

Expert Comment

by:TechTiger007
ID: 22779748
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
 
LVL 13

Assisted Solution

by:TechTiger007
TechTiger007 earned 300 total points
ID: 22779767
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 18

Expert Comment

by:ChetOS82
ID: 22779846
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
 
LVL 13

Expert Comment

by:TechTiger007
ID: 22780960
0
 

Author Comment

by:davidcahan
ID: 22781222
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
 
LVL 13

Expert Comment

by:TechTiger007
ID: 22781356
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
 

Author Comment

by:davidcahan
ID: 22782055
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
 
LVL 23

Expert Comment

by:Tony McCreath
ID: 22784698
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
 
LVL 13

Assisted Solution

by:TechTiger007
TechTiger007 earned 300 total points
ID: 22784828
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
 
LVL 18

Expert Comment

by:ChetOS82
ID: 22785198
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question