473,569 Members | 2,572 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 2301
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" <perlATturbopow erDOTcom> wrote in message
news:ef******** ******@tk2msftn gp13.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*********@de v.null> wrote in message
news:bf******** **@sparta.btint ernet.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*****@ATmicr osoft.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.c om/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/highperfmanaged apps.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
2812
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 (__fastcall etc.). I have tried disabling "compile as managed" option for these specific files, but it does not help: by trial and error I figured out that...
41
3057
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 now!). The application publisher went belly up years ago. Over time we've made a number of VBA code changes (< 500 lines total). Now our CPA is urging...
2
3198
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 the MSIL still gets deployed with the assembly regardless. . . Hope this clarifies things. . .
5
2937
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++ libraries. We are using managed C++ as a bridge between managed .NET code and unmanaged C++ code, which I'm sure is a fairly common practice. The...
1
9445
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 file but it cant call a managed C# dll. I need to create an unmanaged C++.net wrapper for a Managed C# dll. Does anyone know how to do this? can...
1
1624
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 code which works well. I understand the basic concept: our code is unmanaged, Windows Forms is Managed and Unmanaged may not call Managed code. I...
245
7485
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 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)...
3
4695
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 application. Furthermore, I use a pointer to an unmanaged function to jump back into the managed dll. The managed part is basically a remoting...
0
7700
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7676
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7974
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5513
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.