Click here to Skip to main content
15,890,897 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: problem enumerating USB devices on my PDA (Windows Mobile 5.0) - project attached Pin
Richard Andrew x649-Jun-09 8:10
professionalRichard Andrew x649-Jun-09 8:10 
GeneralRe: problem enumerating USB devices on my PDA (Windows Mobile 5.0) - project attached Pin
shpid3r9-Jun-09 9:37
shpid3r9-Jun-09 9:37 
GeneralRe: problem enumerating USB devices on my PDA (Windows Mobile 5.0) - project attached Pin
shpid3r9-Jun-09 9:49
shpid3r9-Jun-09 9:49 
Questionquestion regarding sockets Pin
mkrtchyanmarianna9-Jun-09 2:38
mkrtchyanmarianna9-Jun-09 2:38 
AnswerRe: question regarding sockets Pin
CPallini9-Jun-09 2:55
mveCPallini9-Jun-09 2:55 
Questionquestion regarding sockets Pin
mkrtchyanmarianna9-Jun-09 2:15
mkrtchyanmarianna9-Jun-09 2:15 
AnswerRe: question regarding sockets Pin
led mike9-Jun-09 4:33
led mike9-Jun-09 4:33 
QuestionDetermining efficiency / most-efficient algorithm [modified] Pin
Mike the Red9-Jun-09 1:16
Mike the Red9-Jun-09 1:16 
I have read various statements in this forum saying things like "it's more efficient to x" or "x is inefficient, I'd try y", or the more helpful "x is terribly inefficient, I'd look for a better method."

How do I determine what is efficent/inefficient, or, more specifically, given two algorithms to accomplish a task, how do I determine which is more efficient?

As a relevent example, I have an object whose member vars need to be backed up by a file, and needs to support multiple instances sharing a file (and therefore values); any time the member vars are modified, the file needs to be updated. File access has to be synchronized through IPC.

A first algorithm would be to synchronize file access within the main process, create the object after getting ownership of the sync object, read the file contents after object creation, modify the vars, write to the file, then destroy the object.

A second algorithm would be to have the main process create the object and maintain it through the main process' lifetime, have the IPC synchronization handled within the object whenever the vars are modified.

A third would be to have the main process create and maintain the object, handle synchronization within the main process, and pass a file handle from the main process to the object methods that modify the vars so they can modify the file.

A fourth would be to have the main process create and maintain the object, handle synchronization within the main process, and have the object use a memory-mapped file to maintain the vars.

A fifth would be the same as the fourth, only handling synchronization within the object.

...and I'm sure I could come up with more...

My limited experience has me leaning towards either the second or the fifth as theoretically most-efficient, but how would I go about actually determining this ?


As always, any answers, or suggestions what I should read, are greatly appreciated.

MZR

P.S.
Then, of course, there's also the question of "execution efficiency" (speed) and "memory efficiency." Is the most memory-efficient always the fastest-executing?
AnswerRe: Determining efficiency / most-efficient algorithm Pin
Stuart Dootson9-Jun-09 2:11
professionalStuart Dootson9-Jun-09 2:11 
GeneralRe: Determining efficiency / most-efficient algorithm Pin
Mike the Red9-Jun-09 2:24
Mike the Red9-Jun-09 2:24 
GeneralRe: Determining efficiency / most-efficient algorithm Pin
Stuart Dootson9-Jun-09 2:29
professionalStuart Dootson9-Jun-09 2:29 
AnswerRe: Determining efficiency / most-efficient algorithm Pin
led mike9-Jun-09 4:23
led mike9-Jun-09 4:23 
AnswerRe: Determining efficiency / most-efficient algorithm Pin
Chris Losinger9-Jun-09 5:02
professionalChris Losinger9-Jun-09 5:02 
Questionquestion regarding sockets Pin
mkrtchyanmarianna9-Jun-09 1:01
mkrtchyanmarianna9-Jun-09 1:01 
QuestionRe: question regarding sockets Pin
CPallini9-Jun-09 1:50
mveCPallini9-Jun-09 1:50 
AnswerRe: question regarding sockets Pin
mkrtchyanmarianna9-Jun-09 2:14
mkrtchyanmarianna9-Jun-09 2:14 
GeneralRe: question regarding sockets Pin
CPallini9-Jun-09 2:20
mveCPallini9-Jun-09 2:20 
QuestionLoadLibraryA & LoadLibraryW Pin
chirag_chauhan8-Jun-09 23:05
chirag_chauhan8-Jun-09 23:05 
AnswerRe: LoadLibraryA & LoadLibraryW Pin
Pops80028-Jun-09 23:18
Pops80028-Jun-09 23:18 
AnswerRe: LoadLibraryA & LoadLibraryW Pin
«_Superman_»8-Jun-09 23:24
professional«_Superman_»8-Jun-09 23:24 
GeneralRe: LoadLibraryA & LoadLibraryW Pin
chirag_chauhan8-Jun-09 23:31
chirag_chauhan8-Jun-09 23:31 
GeneralRe: LoadLibraryA & LoadLibraryW Pin
«_Superman_»8-Jun-09 23:34
professional«_Superman_»8-Jun-09 23:34 
AnswerRe: LoadLibraryA & LoadLibraryW Pin
KarstenK8-Jun-09 23:46
mveKarstenK8-Jun-09 23:46 
QuestionError while trying to free memory allocated using malloc Pin
dcj19848-Jun-09 23:04
dcj19848-Jun-09 23:04 
AnswerRe: Error while trying to free memory allocated using malloc Pin
CPallini8-Jun-09 23:10
mveCPallini8-Jun-09 23:10 

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.