Solved

Advantages/Disadvantages of Pre-Compiling

Posted on 2008-10-22
11
686 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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:Tiggerito
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now