Solved

Advantages/Disadvantages of Pre-Compiling

Posted on 2008-10-22
11
692 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 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

631 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