Re: /CLR floating point performance, inter-assembly function call performance
From: Yan-Hong Huang[MSFT] (yhhuang_at_online.microsoft.com)
Date: 05/10/04
- Next message: autodebug: "A good debugger tool, Auto trace all apis."
- Previous message: Sarat Venugopal: "Re: wsprintf deprecated?"
- In reply to: Bern McCarty: "Re: /CLR floating point performance, inter-assembly function call performance"
- Next in thread: Bern McCarty: "Re: /CLR floating point performance, inter-assembly function call performance"
- Reply: Bern McCarty: "Re: /CLR floating point performance, inter-assembly function call performance"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 10 May 2004 02:22:35 GMT
Hello Bern,
Are you still monitoring this thread? We just hold a discusstion between
PSS, SDE and PM.
The listed matrix of tested combination is this:
test.exe geometry.dll (contains workhorse function)
-------- ----------------
v1) native native
v2) managed native
v3) managed managed
The key is that we think that the third variation is using exported
functions and an import library to call the function in geometry.dll, as is
certainly the case with the first two. If this is the case, then it is
mistaken that there are no transitions in this scenario. In fact, there are
twice as many transitions in variation 3 as in variation 2. The reason for
this is the import libraries. Import libraries are a native construct. Any
time a function call is made from managed code to a DLL through a stub in
the import lib, a managed-native transition must happen. And then, since
the actual implementation of the function in the DLL is managed, there must
be another transition back to managed. This is very costly, as you found
out.
The good news is that there is a way around these transitions for the
managed/managed case. Here is a small example:
Code for DLL:
public __value class Utils { // Must have a public
managed type (__value or __gc)
public:
static int func(int i, int j) { // Must be static
unless you don't mind creating instances
return i + j;
}
};
Code for EXE:
#using <testdll.dll> // Pull in the types
defined in assembly testdll.dll
int main() {
return Utils::func(0, 0); // Call the function
}
This will eliminate all transitions from the call from the exe into the DLL.
I will email our SDE and let him look into this post also. If you have any
more concerns, please feel free to post here. Or you can contact us by
removing online from my email address here. Thanks very much.
Best regards,
Yanhong Huang
Microsoft Community Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
- Next message: autodebug: "A good debugger tool, Auto trace all apis."
- Previous message: Sarat Venugopal: "Re: wsprintf deprecated?"
- In reply to: Bern McCarty: "Re: /CLR floating point performance, inter-assembly function call performance"
- Next in thread: Bern McCarty: "Re: /CLR floating point performance, inter-assembly function call performance"
- Reply: Bern McCarty: "Re: /CLR floating point performance, inter-assembly function call performance"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|