have you run a profiler to see duration by function? IMO it's not worth guessing at optimizations until you know what's taking up the time. eg if you find the data structures are taking up the time, you can try optimizing them; but i wouldn't drop all the maps until you know it's the bottleneck.
can you pre-process files?
can you set up a ram disk? if you can't use it for your main use case, you can at least use it to see if i/o is the problem.
Quote
where every task looks like this:
1) Open a file with statistics ... use malloc to allocate memory chunk of the file size and fread it into memory - > close the file.
you didn't mention which part of the app is faster/slower, the io or the processing. you can open your files ahead of time so your other threads aren't waiting on i/o. eg if you have 5 threads processing data at a given time, you can have 6 files opened in memory. as soon as one thread is done, the next data will already be ready instead of taking a break to read from io.
This post was edited by carteblanche on Oct 10 2016 06:59pm