Johnson wrote:
Great. Thank you for your advice.
In addition to Victors comments, there was a thread longer ago
(about half a year?) where somebody implemented a queue in C,
optimised it as much as possible and then compared it to an STL
implementation (I think from g++). It turned out that the STL
implementation was faster no matter how much he optimized the C
queue. I don't remember the outcome of the thread (and I don't
have a msg ID at hand now), but I think it was about that the C++
compiler could perform a better inlining of the templated queue.
Anyway, this was a special case. For general, I second Victors
solution, first get it right and then if you need more
performance, measure first. If it's large data to process the IO
could be more of a bottleneck than the difference between a C and
a C++ container. lg,
Michael
Thank you, Michael. Now I believe the STL might be even faster than
the ANSI C solution. However, I don't understand why the C++
compiler. Can I inlining the queue in C if I want to?