|
You could be right. But it has always been my opinion to just go ahead and test in release mode. Then you don't have to guess if it might make a difference.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I was under the impression that using RDTSC (alone) in a true multi-tasking environment would not yield accurate results due to the fact that the OS is busy doing other things, and your code, no matter how small, might get suspended/swapped.
Peace!
-=- James.
"Fat people are hard to kidnap."
(Try Check Favorites Sometime!)
|
|
|
|
|
This is very true. Which is why you run your tests for a long time and multiple times. There are also things you do to try and make sure all you program code is paged in.
But generally, you never test for raw speed (i.e. X runs in 506ms). You should always test for relative speed (i.e. X runs 23% faster than Y). This helps to make sure that both tests for X and Y are performed in the same environment.
Also, test for repeatability.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
What I am trying to say is that even though what you said is very true. There are things that you can do to still make performance measurement reasonably reliable.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
moliate wrote:
ZeroMemory
If recall correctly Zero Memory is a memset that fills 0's in the destination adress.
Cheers,
Joao Vaz
A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
|
|
|
|
|
Yes, but Joaquín told us it was a macro rather than a function. That's why I found it so odd to get different results on the memset/ZeroMemory.
Apparantly it is never safe to do even the simplest performance testing in a Debug build. Lesson learned.
/moliate
Two o'clock and walking through familiar London - Or what was familiar London before the cursor deleted certain certainties -
I watch a suit and tie man giving suck to the Psion Organizer lodged in his breast pocket
its serial interface like a cool mouth hunting his chest for sustenance, familiar feeling, and I'm watching my breath steam in the air.
Neil Gaiman - Cold Colours
|
|
|
|
|
moliate wrote:
Yes, but Joaquín told us it was a macro rather than a function.
Yeap, Joaquin is right
moliate wrote:
do even the simplest performance testing in a Debug build. Lesson learned
The allocation of memory is monitored in debug builds by the CRT , so it fakes the results ...
Actually ZeroMemory is a macro using the RtlZeroMemory that is also a Macro that uses ...
Cheers,
Joao Vaz
A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
|
|
|
|
|
Actually ZeroMemory is a macro using the RtlZeroMemory that is also a Macro that uses ...
WTF?????
ZeroMemory sub contracts the work out to RtlZeroMemory? I didn't authorize subcontractors!!!!
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Tim Smith wrote:
ZeroMemory sub contracts the work out to RtlZeroMemory?
And guess what ? The RtlZeroMemory does a simple memset !!!!
#define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length))
Tim Smith wrote:
I didn't authorize subcontractors!!!!
Cheers,
Joao Vaz
A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
|
|
|
|
|
Duhhhhhhhhhhhhhhh !
#define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length))
Cheers,
Joao Vaz
A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
|
|
|
|
|
Also consider the fact that you can use intrinsic versions of the memset(...), memcpy(...) , etc. functions.
Peace!
-=- James.
"Fat people are hard to kidnap."
(Try Check Favorites Sometime!)
|
|
|
|
|
Hello guys:
I want to creat a combobox in which user can change item state(for example: on/off) when the list box is displayed.User can toggle item state by clicking left part and selet a item by clicking the right part.
The question is how to handle mousedown message of dropped down list box?
Thank you very much to give me some advice!
example: <a href="http://www.codeguru.com/forum/attachment.php?s=&postid=524383">demo.jpg</a>
|
|
|
|
|
|
Hi,
does anyone have some idea, how to make some TCP network transfer in separate thread (open connection, send/receive some data, close connection, end thread) using WinSock 1.1, so that i can immediately stop thread from parent thread anytime ?
|
|
|
|
|
One approach is this: launch a thread provided with a message pump, and use message-based asynchronous sockets (see WSAAsyncSelect for further info). This thread can be stopped at any time with PostQuitMessage .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Actually the problem is very small . I am using DrawText function . and i want to display the font ac per the system setting so please if anybody can help me wating for the reply.
|
|
|
|
|
Hi,
this link may help you: http://www.ucancode.net/
It shows the advance gdi and font features you like. The client may interest you.
Regards
jack
|
|
|
|
|
Hello,
I want to do drop file support for my window.
But I'm not able to identify if file(s)
droped on it was drag "with right or left mouse button".
(I would like to do popup menu in case of right button)
Is there any way how to solve it?
Thank you.
V. Dolinay
|
|
|
|
|
From MSDN ,
HRESULT DragEnter(
IDataObject * pDataObject,
//Pointer to the interface of the source data
// object
DWORD grfKeyState, //Current state of keyboard modifier keys
POINTL pt, //Current cursor coordinates
DWORD * pdwEffect //Pointer to the effect of the drag-and-drop
// operation
);
grfKeyState
[in] Current state of the keyboard modifier keys on the keyboard. Valid values can be a combination of any of the flags MK_CONTROL, MK_SHIFT, MK_ALT, MK_BUTTON, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON
So as u can see you can test for the mouse button being pressed by anding
//left button
if( grfKeyState & MK_LBUTTON )
{
//Do for left button
}
if( grfKeyState & MK_RBUTTON )
{
//Do processing for right button
}
|
|
|
|
|
Thank you.
That was what I was looking for.
V.Dolinay
|
|
|
|
|
hi,
I am a new socket programmer, I know that socket allow sending buffer of char by send(), if I wont to send a struct or whole class, how I do it?I wish do it by basic socket, then by MFC class.
in reality, I have an application that I would make it work on network, it is installed one several machine , one machine ( the master) send to the others data (object, commend)and the result is sent to this machine,
thanks.
|
|
|
|
|
You can send() your struct/class as raw bytes. sizeof will tell you how many bytes. And at the other side you must recv() that many number of bytes into a pointer to your struct/class cast to a byte *
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
thanks,
If my struct is:
struct X{
int..;
char*..;
..
};
struct X Y;
and I woul send Y by send(),how i send it as raw bytes, i cast it: send(socket,(byte *)Y,sizeof(Y),0)?
and wen I received it I will recost it:
....
int i=recv(socket,buf,..)
struct X* pX;
pX=(struct X*)buf;
...?
|
|
|
|
|
That should work BUT ONLY IF your struct DOES NOT HAVE ANY pointer members. In your case you seem to have a char*. Replace char* with a char[].
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hello
I would like my database app to be able to store files... is this easy to do via CRecordset class.
Any tips would be nice.
Best regards
Henrik
|
|
|
|