Click here to Skip to main content
15,910,234 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionImpact of synchronization on application performances Pin
Ahmed Charfeddine19-Aug-08 5:30
Ahmed Charfeddine19-Aug-08 5:30 
AnswerRe: Impact of synchronization on application performances Pin
Roger Stoltz19-Aug-08 5:51
Roger Stoltz19-Aug-08 5:51 
GeneralRe: Impact of synchronization on application performances Pin
Ahmed Charfeddine19-Aug-08 6:16
Ahmed Charfeddine19-Aug-08 6:16 
GeneralRe: Impact of synchronization on application performances Pin
Ahmed Charfeddine19-Aug-08 22:12
Ahmed Charfeddine19-Aug-08 22:12 
AnswerRe: Impact of synchronization on application performances Pin
Roger Stoltz19-Aug-08 22:46
Roger Stoltz19-Aug-08 22:46 
GeneralRe: Impact of synchronization on application performances Pin
Ahmed Charfeddine19-Aug-08 22:53
Ahmed Charfeddine19-Aug-08 22:53 
AnswerRe: Impact of synchronization on application performances Pin
Roger Stoltz19-Aug-08 23:39
Roger Stoltz19-Aug-08 23:39 
GeneralRe: Impact of synchronization on application performances Pin
Ahmed Charfeddine20-Aug-08 0:16
Ahmed Charfeddine20-Aug-08 0:16 
I appreciate your tips and information generosity.

Well I knew about the std::map, the MFC CArray or CMap ..and other containers.
lookup time ,in my point of view, is not determined so much by the actual used container. Rather by the compare function I think.
Ie, in my case doing the following :

CPlayer* getPlayerByName(CString targetName)
{
for (int i=0 --> maxPlayers)
if(playersTab[i].getName()==targetName)
return &playetrsTab[i];

return NULL;
}

does much depend, if profiled, on the time spent within the string compare operations.

It is already, Roger, that I am stuck on the problem of the synchronization of such variable as the name of the player, since setName and getName will cause the application to crash if run concurrently unless I do synchronization which I am fearing its impact on overall application performance.

The article you supplied is very interesting, and by the way, it is written by someone BIG.Sadly, even if I am actually resolving the problem of the efficient handling of multiple Network IOs by use of IO Completion just like M.Joseph advised for good results, I find it unavoidable to do such "explicit" synchronization as the one I am intending to do on CPlayer::name using CriticalSection and on the many data varaiables that are accessed by worker trhread procedure.


My application is a server application, that I would like to deploy on a server machine one day.
I am using simple C type arrays, instead of the dynamic containers as std::map,etc becuase it isa lready that I wo'nt do any dynamic memory allocation in order to avoid RAM fragmentation. There are many types of data, creating them on the heap also causes a waste of space.

I would like to fix the possible maximum of data that can be handled by the server from the start, then only worry about crash scenarios and may be also certain severe inconsistencies..before I would let the application perform 24h/24.

Yes I know smart pointers, I recenly received an XML parser implementation in C++ by a freindly person from France, and that does the automatic allocation and deallocation of memory : it is like a heap object created and refreneced by the stack object so to do the "delete" automatically in the destructor of the stack object...

As I said, I allocate data from the start, I reuse them all the time.
....

Our Philosophy, Mohammed Baqir Al Sadr

GeneralRe: Impact of synchronization on application performances Pin
Roger Stoltz20-Aug-08 4:33
Roger Stoltz20-Aug-08 4:33 
GeneralRe: Impact of synchronization on application performances Pin
Ahmed Charfeddine20-Aug-08 5:54
Ahmed Charfeddine20-Aug-08 5:54 
AnswerRe: Impact of synchronization on application performances Pin
Jijo.Raj19-Aug-08 6:40
Jijo.Raj19-Aug-08 6:40 
GeneralRe: Impact of synchronization on application performances Pin
Ahmed Charfeddine19-Aug-08 6:53
Ahmed Charfeddine19-Aug-08 6:53 
GeneralRe: Impact of synchronization on application performances Pin
Jijo.Raj19-Aug-08 7:19
Jijo.Raj19-Aug-08 7:19 
GeneralRe: Impact of synchronization on application performances Pin
Ahmed Charfeddine19-Aug-08 21:50
Ahmed Charfeddine19-Aug-08 21:50 
GeneralRe: Impact of synchronization on application performances Pin
Cedric Moonen19-Aug-08 7:22
Cedric Moonen19-Aug-08 7:22 
GeneralRe: Impact of synchronization on application performances Pin
Ahmed Charfeddine20-Aug-08 0:39
Ahmed Charfeddine20-Aug-08 0:39 
GeneralRe: Impact of synchronization on application performances Pin
Cedric Moonen20-Aug-08 1:08
Cedric Moonen20-Aug-08 1:08 
GeneralRe: Impact of synchronization on application performances Pin
Ahmed Charfeddine20-Aug-08 1:37
Ahmed Charfeddine20-Aug-08 1:37 
GeneralRe: Impact of synchronization on application performances Pin
Cedric Moonen20-Aug-08 2:11
Cedric Moonen20-Aug-08 2:11 
GeneralRe: Impact of synchronization on application performances Pin
Cedric Moonen31-Aug-08 22:35
Cedric Moonen31-Aug-08 22:35 
QuestionHow to get the full path of a file (Win32 api) Pin
ice87111719-Aug-08 4:43
ice87111719-Aug-08 4:43 
AnswerRe: How to get the full path of a file (Win32 api) Pin
David Crow19-Aug-08 5:07
David Crow19-Aug-08 5:07 
QuestionRe: How to get the full path of a file (Win32 api) Pin
led mike19-Aug-08 5:27
led mike19-Aug-08 5:27 
AnswerRe: How to get the full path of a file (Win32 api) Pin
ice87111720-Aug-08 19:26
ice87111720-Aug-08 19:26 
AnswerRe: How to get the full path of a file (Win32 api) Pin
Member 419459319-Aug-08 7:40
Member 419459319-Aug-08 7:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.