473,406 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

ASP code vs COM Components

CJM
I realise this question has come up in some form or other many times in the
past, but indulge me, please.

I've just been reviewing a COM component (VB6) that I wrote a while ago to
record when and where 404 errors occur; each error is logged in a DB along
with supporting information.

Looking at it now, I'm wondering why I chose a COM component rather than
just an ASP page. There is not that much code involved, so I could easily
have expanded the ASP page that calls the DLL to do the whole job....

COM Component:
Generally perform faster than an ASP page, but there is an overhead
associated with creating a new object in the calling ASP page, so more
suited to more intense apps that dont require user-interaction. Also keeps
code private of course.

ASP:
Keeping you code in an ASP page is often more efficient for smaller jobs,
where the cost of creating a COM object outweighs the potential performance
gain. Also prefered for tasks that require frequent user interaction. Code
remains public (to those who have access to server).

This is what prompted my question: At what point, does it become worthwhile
to go for a COM component as opposed to an ASP page? Is there that much
difference in it?

Are perceptions of the issues fairly accurate?

I've updated the DLL in question - it was a bit of a ball ache: modify code
& compile, reset IIS, then copy DLL to server and re-register. I know my DLL
in this example doesnt do much, and I'm certain that modifying and copying
ASP pages would be simple & efficient, but at what point does it pay to use
a DLL?

Thanks

Chris
Jul 19 '05 #1
7 1635
CJM wrote:
COM Component:
Generally perform faster than an ASP page, but there is an overhead
associated with creating a new object in the calling ASP page, so more
suited to more intense apps that dont require user-interaction. Also
keeps code private of course.


No argument with the security factor. However, performance has been shown to
be better with straight ASP. See here:
http://msdn.microsoft.com/library/en...ocu2kbench.asp
Jul 19 '05 #2
Anthony J Biondo Jr wrote:

Hi Chris:

The way I look at it, if you have allot of processing and logic you need to
perform it should be done in COM, because of the sheer fact that each time a
person hits the page it does not need to be recompiled.
An ASP page is NOT recompiled every time a person hits it!

It is only compiled for the first request; thereafter the pre-compiled
pcode (bytecode) is cached in IIS memory so all subsequent requests can
be executed immediately. For a description of the compilation and
execution process see Appendix 3 of
http://www.microsoft.com/technet/tre...e/iis5tune.asp

To see a sample of the compiled bytecode see
http://groups.google.com/groups?q=+%...-pc.org&rnum=2
I guess everyone
has their own perception of what "allot of processing" would be. I know
that we use COM for the web where we expect allot of hits and have critical
functions that need to happen. User Authentication, Logging, Inquiries to
other data stores.


In the light of how IIS and ASP *really* work, your methodology should
be re-evaluated. COM components will enhance performance only if the
task is *highly* CPU-intensive. I/O bound tasks (e.g., "User
Authentication, Logging, Inquiries to other data stores") do not qualify
and will perform better when done in ASP script. Before components pay
off performance-wise, you must have a *lot* of compute-bound code:

"Rule of thumb: unless there are at least 100 lines of script and some
big loops in that script, it's probably not worth thinking about
translating that page into a component."
Alex Homer, Dave Sussman, Brian Francis
page 1042,
"Active Server Pages 3.0"
(Wrox Press Ltd., 1999)

See http://groups.google.com/groups?oi=d...m=an_558802478 for more
details.
Good Luck,
Michael D. Kersey
Jul 19 '05 #3
"Michael D. Kersey" wrote:
<snipped>
It is only compiled for the first request; thereafter the pre-compiled
pcode (bytecode) is cached in IIS memory so all subsequent requests can
be executed immediately. For a description of the compilation and
execution process see Appendix 3 of
http://www.microsoft.com/technet/tre...e/iis5tune.asp
Apologies, the above URL is unduly nested. The correct URL is
http://www.microsoft.com/technet/pro...asp?frame=true
Good Luck,
Michael D. Kersey

Jul 19 '05 #4
Perfect example is when your dll implements business logic
needed on both Web server and application(non-Web) server.
You can not share your asp code between two.

Another case would be a number-crunching task that
consumes CPU cycles. You are better off with compiled
code.

ANother one: ASP does not (at least explicitly) support
data types. You do not want to deal with ASP when the data
type matters (calculations or conversions). It can play
nasty tricks on you unless you deeply understand the
underlying data types in ASP.

Last one: Use of 3-d party libraries. You might be better
of with a wrapper around the library for the above reason
of data conversions.

Good luck.
Makes no sense for a 3-liner.
-----Original Message-----
I realise this question has come up in some form or other many times in thepast, but indulge me, please.

I've just been reviewing a COM component (VB6) that I wrote a while ago torecord when and where 404 errors occur; each error is logged in a DB alongwith supporting information.

Looking at it now, I'm wondering why I chose a COM component rather thanjust an ASP page. There is not that much code involved, so I could easilyhave expanded the ASP page that calls the DLL to do the whole job....
COM Component:
Generally perform faster than an ASP page, but there is an overheadassociated with creating a new object in the calling ASP page, so moresuited to more intense apps that dont require user- interaction. Also keepscode private of course.

ASP:
Keeping you code in an ASP page is often more efficient for smaller jobs,where the cost of creating a COM object outweighs the potential performancegain. Also prefered for tasks that require frequent user interaction. Coderemains public (to those who have access to server).

This is what prompted my question: At what point, does it become worthwhileto go for a COM component as opposed to an ASP page? Is there that muchdifference in it?

Are perceptions of the issues fairly accurate?

I've updated the DLL in question - it was a bit of a ball ache: modify code& compile, reset IIS, then copy DLL to server and re- register. I know my DLLin this example doesnt do much, and I'm certain that modifying and copyingASP pages would be simple & efficient, but at what point does it pay to usea DLL?

Thanks

Chris
.

Jul 19 '05 #5
CJM
This is this is my understanding also...

And you have essentially provided a good rule of thumb:

If the task is CPU-intensive (eg > 100 lines of code) then a COM solution
may offer some benefits, otherwise, an ASP-only solution is likely to be the
best result.

...other conserations permitting....

It's what I suspected, but it's good to hear it again.

Thanks

"Michael D. Kersey" <md******@hal-pc.org> wrote in message
news:3F***************@hal-pc.org...
Anthony J Biondo Jr wrote:

Hi Chris:

The way I look at it, if you have allot of processing and logic you need to perform it should be done in COM, because of the sheer fact that each time a person hits the page it does not need to be recompiled.
An ASP page is NOT recompiled every time a person hits it!

It is only compiled for the first request; thereafter the pre-compiled
pcode (bytecode) is cached in IIS memory so all subsequent requests can
be executed immediately. For a description of the compilation and
execution process see Appendix 3 of

http://www.microsoft.com/technet/tre...e/iis5tune.asp
To see a sample of the compiled bytecode see
http://groups.google.com/groups?q=+%...-pc.org&rnum=2
I guess everyone
has their own perception of what "allot of processing" would be. I know
that we use COM for the web where we expect allot of hits and have critical functions that need to happen. User Authentication, Logging, Inquiries to other data stores.


In the light of how IIS and ASP *really* work, your methodology should
be re-evaluated. COM components will enhance performance only if the
task is *highly* CPU-intensive. I/O bound tasks (e.g., "User
Authentication, Logging, Inquiries to other data stores") do not qualify
and will perform better when done in ASP script. Before components pay
off performance-wise, you must have a *lot* of compute-bound code:

"Rule of thumb: unless there are at least 100 lines of script and some
big loops in that script, it's probably not worth thinking about
translating that page into a component."
Alex Homer, Dave Sussman, Brian Francis
page 1042,
"Active Server Pages 3.0"
(Wrox Press Ltd., 1999)

See http://groups.google.com/groups?oi=d...m=an_558802478 for more
details.
Good Luck,
Michael D. Kersey

Jul 19 '05 #6
CJM
"Tamara" <t_*****@yahoo.com> wrote in message
news:02****************************@phx.gbl...
ANother one: ASP does not (at least explicitly) support

data types. You do not want to deal with ASP when the data
type matters (calculations or conversions). It can play
nasty tricks on you unless you deeply understand the
underlying data types in ASP.

Last one: Use of 3-d party libraries. You might be better
of with a wrapper around the library for the above reason
of data conversions.


Yes, its a fair point about type-conversion...

Thanks
Jul 19 '05 #7
CJM
That's a good link Bob.

Takes a bit of reading but very 'enlightening'!

Thanks
"Bob Barrows" <re*******@yahoo.com> wrote in message
news:u%****************@TK2MSFTNGP10.phx.gbl...
CJM wrote:
COM Component:
Generally perform faster than an ASP page, but there is an overhead
associated with creating a new object in the calling ASP page, so more
suited to more intense apps that dont require user-interaction. Also
keeps code private of course.
No argument with the security factor. However, performance has been shown

to be better with straight ASP. See here:
http://msdn.microsoft.com/library/en...ocu2kbench.asp

Jul 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

242
by: James Cameron | last post by:
Hi I'm developing a program and the client is worried about future reuse of the code. Say 5, 10, 15 years down the road. This will be a major factor in selecting the development language. Any...
6
by: Mario T. Lanza | last post by:
Greetings, I don't know about you guys but on many occasions I've asked myself whether or not someone else has solved a particular programming issue -- whether or not they developed a clever...
3
by: Deano | last post by:
Thought it might be a cool feature to allow my users to click a button, and connect to a webpage that would tell them if a more recent version was available. I can create a button that opens a...
0
by: Norbert Heidbüchel | last post by:
Hi all, I have read a lot of postings and web pages about drag and drop and treeviews, but could not find an answer to my problem. Sorry, if I missed something. I am trying to drag and drop...
1
by: Andrew K | last post by:
Hi, This is a problem I noticed in one of my applications the other day and can't figure out how to fix. In the attached code I have 2 forms. The form named form1 is the MDI container, form2...
11
by: Keith | last post by:
I apologize for those of you who think I'm posting on the same topic. It is not that I don't appreciate all of your comments - and I'm definitely reading them all - but I think I have a differing...
1
by: John | last post by:
Hi all, I did post this about 10 hours ago thinking I would have received an answer now but it is quite urgent. How do I add a COM object to a web form? I notice there's a primary interop...
6
by: cj | last post by:
Lets just take this example I'm looking at now. I'm looking at the help screen titled .NET Framework Class Library FolderBrowserDialog Class . It gives an example at the bottom that begins with:...
1
by: Don | last post by:
I'm getting the following exception displayed in the task list at design time for my project: "Code generation for property 'Controls' failed. Error was: 'Object reference not set to an...
7
by: Olegus | last post by:
Hello, in order to perform backup/restore MSSQL database using SMO, one needs to reference several namespaces in a backup class : using Microsoft.SqlServer.Management.Common; using...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.