Case 3's being so slow is weird, but since all x86 processors do floating point math using an 80bit denormalized value internally there shouldn't be any architectural level difference in the performance. At a guess, 64bit machines are still rare enough to be a relatively low priority for the optimizers.
Just to make things a little more confusing. In the Release version or youre code, you're only doing one math problem at runtime. The optimizer will evaluate the math of 2 constant values into a resultant constant and substitute that constant for the code used to get it.
You're actually just mov'ing two float64 constants to the two locations a and b. Then the division takes place and is assigned to c as a float64 result.
You're code is actually this:
for(int x = 0; x < 100000000; x++)
double a = 1524157.8750190521double b = 152415787.50190521double c = a / b;
But, that's not the problem. The problem is that your still running under a 32-bit OS. You can't use any of the 64-bit instruction set, including math instructions, until you replace your OS with Win64 enabled Windows. Until then, your doing 64-bit math using only the 32-bit instruction set, which, oddly enough, is slower on the 64-bit chips.
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
I am calling a dll from C#.
The dll is called from a single function call in C# (dllimport ...)
The dll produces data, which I want to access in real-time as and when it is generated in C#. However, the single function call will obviously only return the final answer.
How can I setup either the dll or the C# to give me data as I require? Do I need to make an additional function call in C# that gives me access to the data or will the dll have to setup to send data back periodically? If so, how can I do this?
Your help is appreciated.
Let me ask if I'm understanding your problem correctly. Your C/C++ dll produces data in real-time, but only gives the final result back, yet you want your C# code to have access to the real-time data? If that's what you want, then you have a few options. One option is to split up the C/C++ function into several functions, each returing parts of the real-time data. Another option is to pass a delegate type to the C/C++ dll which will be called from inside the C/C++ dll as it receives real-time data. I'd recommend the latter option.
Yes that's what I'm trying to do. The dll is written in Fortran so splitting up the routines is definitely not something I want to do.
I was half-expecting the answer to be on multithreading whereby a call would be made to the main process and periodically a call would be made to the fortran routine that keeps the data with a flag so tell C# that new data has arrived.
I'm unable to convert code that works in MFC for Pocket PC (2003 using VisualStudio 2005 beta 2) to C#. The basic idea is to use the COM object for Pocket Internet Explorer to gain access to the HTMLDocument object.
In MFC this is done in the view class with something like (error handling removed for brevity)
i need a long Image array of  images of 900x1100 pixel
i made it and it works...
but the access of it is slow in my application when i push a button i just use 5 images of this array and make just some modification, draw some line cut a part of the first, a part of the second and put all together.
It works slow becouse i use GDI+.
How can make it to works faster?
Can i use some faster memory area of my pc?
Loading 300 images, each 900x1100 in dimensions is gonna kill your memory usage. There's just no way to do this on a desktop PC, memory will shoot through the roof, dragging your system to a crawl.
So my first suggestion, don't load all 300 images into memory. Load the images you need, and call Dispose() on them when you're done. This should improve your performance (and memory usage) quite a bit.
IF you're using 32bit color that's ~1.2gigs of data. Between application and OS level overhead, you'll probabably need at least 1.5gig of ram to keep the entire working set in memory at once. If your application needs to run on more modest machines you'll need to redesign your architecture to only load a fraction of the images at a given time. You could try storing the data in memory in a compressed format and only expanding the images as needed, you'll still have a fairly large ammount of overhead, but if you need the entire collection in working memory at once it would probably be better than thrashing the swapfile.
If you are trying to perform some image processing routines, then you should use LockBits and process your image using unsafe mode. It will be much faster, then using SetPixel/GetPixel.
But, as it was already said here, you need to avoid loading all 300 images. Even with unsafe mode it will be rather slow, because you will need much memory. And if you have no such much memory, then will lose performance on memory swapping.
I am facing a problem with DirectPlay in C# is that
I want to simulate half duplex voice chating. Like whenever a person want to
talk, it press a button "Push to Talk". So, all other persons listen like in conference room. It means only one person can talk at one time. If someone press the button "Push to talk" while another talking, voice quality should be degrade.
Can i do this with TCPClient / TCPListener classses. If yes, how i can get audio stream from TCPClient object and how i playback.
Thanks Thanks Thanks in advance. Please help me urgently
I'm a little fuzzy on this. How do I get a saved filed to display the same Icon/image as the application?
Thank you for you responses.
"Art doesn't want to be familiar. It wants to astonish us. Or, in some cases, to enrage us. It wants to move us. To touch us. Not accommodate us, make us comfortable." -- Jamake Highwater Toasty0.com My Grandkids