473,396 Members | 2,111 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,396 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 2284
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
0
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,...

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.