Quote:
Originally Posted by
Corona688
Optimization can cause errors in programs with subtle bugs. Places where accidental writing to stack or incidental return values hadn't mattered before, suddenly may. Proper programming practices will circumvent this, and the benefits of optimization can be very good.
Indeed. That's why I said I'll leave optimization as my last option.
First I'll make it fast and correct (hopefully bug free), then switch to optimization to make
it even faster (even if of a small percentage). At that stage, if a bugs come up, it is easier to find. At least, that's what I've learned.
---------- Post updated at 02:59 AM ---------- Previous update was at 02:51 AM ----------
Quote:
Originally Posted by
jim mcnamara
Try a static link - that is one easy way to profile shared routines.
Hmm... interesting.
Quote:
Originally Posted by
jim mcnamara
However try these as base assumptions:
most of the problems you have are yours, not library code
In fact, the library is mine! :-D I developed it.
Quote:
Originally Posted by
jim mcnamara
algorithms and proper program design give the best return on optimization by far
code tricks result in very minor gains
Indeed! I'm not trying to achieve optimization with this kind of tricks.
As I said, I still haven't profiled my code and my post was only about how
to best resolve that particular problem (decoding a payload which byte order
is based on a header flag, which can only be known at runtime).
Quote:
Originally Posted by
jim mcnamara
Do you know about aio (asynchronous I/O)? try reading up on that. It is often used in high demand high volume I/O design (disk). I think it is still not fully supported for sockets in Linux. I don't know for sure.
Yes. I've already read about aio and I did consider it. I might use it for dumping
the data, I receive from the net.
Quote:
Originally Posted by
jim mcnamara
gprof - this is a good as there is:
GNU gprof
Thanks for the whole reply!