473,503 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2285
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
2794
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
3042
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
3187
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
2924
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
9439
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
1614
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
7361
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
286
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
4683
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
7202
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
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7280
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,...
1
6991
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
7462
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
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.