473,394 Members | 2,052 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,394 software developers and data experts.

Unmanaged Code switch - how much does it cost.

We have been trying to avoid switches to unmanaged code in our development,
but have recently folded in a call to CDO by using System.Web.Mail as a
quick way to send email.

Yes this is a call to unmanaged code - but does anyone have any figures for
what that costs to do that switch?

How significant is a switch to unmanaged code (and back) bearing in mind
that it costs time to resolve the SMTP servers address and connecting to the
SMTP server.

Thanks in advance

Mart
Jul 19 '05 #1
3 2283
Here's a free option that might help you to avoid the question:
http://www.quiksoft.com/freesmtp/.

Scott
We have been trying to avoid switches to unmanaged code in our development, but have recently folded in a call to CDO by using System.Web.Mail as a
quick way to send email.

Yes this is a call to unmanaged code - but does anyone have any figures for what that costs to do that switch?

How significant is a switch to unmanaged code (and back) bearing in mind
that it costs time to resolve the SMTP servers address and connecting to the SMTP server.

Jul 19 '05 #2

"per larsen" <perlATturbopowerDOTcom> wrote in message
news:ef**************@tk2msftngp13.phx.gbl...
Mart,

In my experience, the execution overhead of an managed/unmanaged/managed
code switch by itself is only a fraction of a millisecond, so that
shouldn't cause any concern in your case. I guess if you were passing
lots of complex data (strings and such, which require special
marshaling) and did this a lot then the overhead could become
prohibitive, but it doesn't sounds like that's the case here.
Thanks for your reply.

- Per

"Mart Rogers" <ma*********@dev.null> wrote in message
news:bf**********@sparta.btinternet.com...
We have been trying to avoid switches to unmanaged code in our

development,
but have recently folded in a call to CDO by using System.Web.Mail as

a
quick way to send email.

Yes this is a call to unmanaged code - but does anyone have any

figures for
what that costs to do that switch?

How significant is a switch to unmanaged code (and back) bearing in

mind
that it costs time to resolve the SMTP servers address and connecting

to the
SMTP server.

Thanks in advance

Mart


Jul 19 '05 #3

"Andrew Downum [MSFT]" <an*****@ATmicrosoft.D0Tcom> wrote in message
news:20****************************@phx.gbl...
The amount of time spent in a managed/unmanaged transition
will be totally dwarfed by anything that has to make a
network call. I don't have the exact number on hand, but
a simple managed-unmanaged function call with no
parameters ends up being somewhere on the order of a dozen
machine cycles, compared to a network request which could
easily end up in the multiple-millisecond range (or even
much longer on a latent network).

My general advice would be to write your app using the
most intuitive approach without stressing the performance
of every little call, and then run through your app with a
profiler and see just where the performance hotspots are.
I can almost guarentee that you will find much more
significant places to invest your optimization efforts
than managed/unmanaged transitions.

Thank you for your reply Andrew.

~ Andrew
DISCLAIMER: This posting is provided "AS IS" with no
warranties, and confers
no rights. Use of any possible included code samples are
subject to the
terms specified at
http://www.microsoft.com/info/cpyright.htm"

For a series of excellent articles on high perf managed
code, see
http://msdn.microsoft.com/library/?url=/library/en-
us/dndotnet/html/highperfmanagedapps.asp (specifically
the "COM Interop and Platform Invoke" section)
and the very excellent:
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dndotnet/html/fastmanagedcode.asp
(the "resources" section at the bottom of these have lots
of good links)
-----Original Message-----
We have been trying to avoid switches to unmanaged code

in our development,
but have recently folded in a call to CDO by using

System.Web.Mail as a
quick way to send email.

Yes this is a call to unmanaged code - but does anyone

have any figures for
what that costs to do that switch?

How significant is a switch to unmanaged code (and back)

bearing in mind
that it costs time to resolve the SMTP servers address

and connecting to the
SMTP server.

Thanks in advance

Mart
.

Jul 19 '05 #4

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

Similar topics

0
by: kaalus | last post by:
Hello I have problem mixing managed and unmanaged C++ code in VS.NET 2003. I want to create a windows forms application which uses some C++ code that is incompatible with managed extensions...
41
by: Matt Alanzo | last post by:
Our SOHO 2 person compay sells furniture (not programmers). In '98 we paid $,$$$ for a VBA -Access '97 accounting application, including VBA source code .... an huge investment for us then (and...
2
by: JKJ | last post by:
Short answer: no. C# apps must run within the .NET framework. You can 'ngen' the assembly, but the framework must still exist on the target machine to read all of the assembly's metadata, and...
5
by: Adam McKee | last post by:
We are using Visual Studio.NET 2003 in our project with .NET framework 1.1. One of our libraries is a mixed-mode dll assembly consisting of one managed C++ library, and several unmanaged C++...
1
by: Zapbbx | last post by:
I have a 3rd party application that can reference external dll's. The dll's have to be written in unmanaged code with an exported function I can reference and call. I would like it to call a C# dll...
1
by: Sparhawk | last post by:
Hi, my company is going to migrate a large VC++ application to .NET to make use of Windows Forms (the old class library is not updated any more). We are not planning to migrate the rest of the...
245
by: Vortex Soft | last post by:
http://www.junglecreatures.com/ Try it and tell me what's happenning in the Microsoft Corporation. Notes: VB, C# are CLS compliant
9
by: Mart Rogers | last post by:
We have been trying to avoid switches to unmanaged code in our development, but have recently folded in a call to CDO by using System.Web.Mail as a quick way to send email. Yes this is a call to...
3
by: Klaus | last post by:
Hi, I have an existing VC 6 MFC application which communicates asynchronly with a VC 2005 managed code dll. I use an unmanaged base class with virtual functions to access methods in the MFC...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.