|
Did some work for a friend over the weekend. Basic scenario was that he had a client who wanted to have a program built that processed some numbers. He wanted a test app built in Java, C#, VB.NET and C++. My friend had already developed the C# app so he sent me the code and I translated to C++. Initial testing looked like the C# app was as fast and sometimes faster than the C++ app...in debug and release.
I found that true until I stopped writing to the console. And even more so when I used profile guided optimization. At that point the C++ app embarrased the C# app. And in the same way C# cuts in half the time for VB.NET. The client decided not to look at Java knowing it didn't stand much chance.
C++
Total Time: 25.47ms
Per Tick: 0.00029ms // note that I had to extend this just to see the result!
Per 50K Ticks: 14.62ms
C#
Total Time: 185.10ms
Per Tick: 0.0021ms
Per 50K Ticks: 106.23ms
Bottom line for me is that the heavy lifting still belongs to C++!!
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
|
May I ask which version of VC++ you used? Reason I ask is because my time comparisons between VC++ 6.0 and VC++ 2003(Native) showed that the VC++ 2003 code embarassed the code from VC++ 6.0. This was without using any optimized compiler or settings. (Turning the optimized settings on VC++ 2003 and playing with the compiler optimization switches yielded less favorable results for some odd reason)
Since C# is from a newer generation of compilers, comparing it with VC++ 6.0 might not be as impressive for C++ programmers as comparing C# with VC++ 2003.
For what it's worth.
Anyway, thanks for sharing the results
|
|
|
|
|
VS2005. I'm going to rewrite the code using C++/CLI just to see what it does. I'll put that up shortly.
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
FWIW, I am a bit surprised by this. I would hesitate to suggest that perhaps the C# app hasn't been optimised very well or written as well as it could have been. I would expect the C++ app to be maybe 2 or 3 times faster, but not 7.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I was shocked. I didn't think there would be much difference!
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
Hallo
so far i understood:
Using RegisterShellFileTypes() adds a string to the registry. So double clicking a file opens the app.
But the regkey ends up with \dde and i would like to have %1
What do i have to do ??
THX
Tim
-- modified at 19:27 Monday 22nd May, 2006
|
|
|
|
|
Errr... Does it actually work though. Using DDE is just fine. You shouldn't have to change anything.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I have a multi-threaded SDI app using VC++ 6.0 SP6 (MFC)
It has crashed multiple times without any sign of why. in other words it just closes. No memory exception, illegal operation, dr watson error, and nothing in the user.dmp file
Any ideas on what can cause a windows app to simply dissapear.
Thank you!!!!
John
|
|
|
|
|
I've seen this before. In my case it was caused by stack corruption breaking the exception handling chain (which is on the stack). I've got an application at home that intentionally reproduces the problem. When I get home I'll send it to you if you think it will be of any help.
Steve
|
|
|
|
|
I sent the application. Did you recieve it?
Steve
|
|
|
|
|
hi, i have made a program that will load other programs from dll files. i have it working just fine on my own pc but when i go to have someone else test it, it fails to load anything at all. am i doing soemthign wrong with how i have my program loading the dll files?
|
|
|
|
|
swatgodjr wrote: am i doing soemthign wrong with how i have my program loading the dll files?
When you are using the DLL on your M/C no problem because that DLL is already registered on your M/C
When you use it on other M/C the Application is not able to find the Registered DLL.
So try to register your DLL on Other M/C where you execute your Application.
use Regsvr32 - for registration
use Regsvr32 /u - for unregistration.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
i tried to use that on another pc but it came back sayign it could not be found on the pc.
|
|
|
|
|
swatgodjr wrote: i tried to use that on another pc but it came back sayign it could not be found on the pc.
Is it your DLL ( created by you for your application) ?
if no then
What is the name of the DLL ,that you trying to load ?
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
i made the dll myself, i am using LoadLibrary to load it in my program.
originally my application was console based and it ran perfectly, loaded on any pc i put it on. but since turnign it into a dialog based gui application, using the exact same loading code, it fails to load now on any pc but mine.
|
|
|
|
|
Pay special attention to the search order in the LoadLibrary documentation. Where your dll is in relation to the "Paths" searched is important. A_Laxman mentioned the COM based way of how the dll path is "registered" in the registry so an app can search the ProgId or CLSID of the component to obtain the info such as what it's path is. You are basically trying to achieve the same end via whatever means you have at your disposal.
If you don't ensure your dll is located in one of the paths mentioned in the LoadLibrary documentation (Try not to rely on the PATH environment variable as this is a user configurable item and subject to change when users jack around with their settings), you might want to have your app installation msi place the path in your registry space for your installation. I do this and then retrieve the settings (including the path to the apps "bin" directory which is where I place my dll's).
If your using VC++ 6.0, you will probably need the Visual Studio Enterprise Installer 1.1 to quickly build your MSI's. You really shouldn't be deploying apps that have dll's and other components without an MSI (at least in native C++ deployment)
here's the link..
Visual Studio Installer[^]
This also make COM component registration/unregistration an automated process and simplifies things since it puts your app in the add/remove programs applet window.
-- modified at 11:23 Tuesday 23rd May, 2006
|
|
|
|
|
the way my app works is nothign really big and complicated, its just a simple program i made to mess aroudn with. i do not "install" it on a pc in any way, i just send it to friends to test if it works. basically you open the exe, go into a screen where you type in the dll to load and the program loads it. its not complicated at least not in my eyes. i did notice that on my pc loadlibrary call is all i need to load the dll file, i do not have to get any addresses to the functions. but when i tell it to do that it crashes after i close the dll. my consoel based version works perfectly on any pc yet migrating the whole thing over to gui based seems to have changed how it does the loading of my dll files.
|
|
|
|
|
Are we sure the DLL is COM based?
You may be dealing with a traditional dll here that uses LoadLibrary(). The thread initiator did not specify this unfortunately.
|
|
|
|
|
Hello,
When I created a small test file:
<code>
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
int number;
cout << "Enter a number (1 or 2): ";
cin >> number;
if (number != 1 || number != 2)
{
cout << "You didn't enter a 1 or 2" << endl;
}
else
{
cout << number << endl;
}
return 0;
}</code>
The result always "You didn't enter a 1 or 2" no matter what number was entered. I tried changing the code to:
<code>
if ((number != 1) || (number != 2))
</code>
with the same results. Any clues? Thanks in advance.
|
|
|
|
|
|
Shane Ragone wrote: (number != 1 || number != 2)
Try writing a truth table for this and see what the result is . You'll find that the result is always true. What you actually want is if (number != 1 && number != 2)
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi guys,
I am using isinf() function in my program. But in VC++ it is giving me the error "isinf undefined identifier". Does anybody know how to make isinf() function work in VC++?
Thank you very much.
jay111
|
|
|
|
|
_fpclass
bool isinf(double d)
{
int fpc = _fpclass(d);
return fpc == _FPCLASS_NINF || fpc == _FPCLASS_PINF;
}
Some of us walk the memory lane, others plummet into a rabbit hole
Tree<t> in C# || Fold With Us! || sighist
|
|
|
|
|
hi peterchen,
thanx for your reply. I didnt quite get what you r saying in your reply...I can compile my program in unix shell with gcc compiler without any error. But i want to port my project to VC++. But in VC++ it is giving i m getting the error.
thanx,
jayashri
jay111
|
|
|
|