Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Advantages/Disadvantages of Pre-Compiling

Posted on 2008-10-22
11
Medium Priority
?
694 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 18

Accepted Solution

by:
ChetOS82 earned 800 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 1200 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
Technology Partners: 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!

 
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
 

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

721 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