View Single Post
Old 03-02-2009, 06:38 AM   #6 (permalink)
Drenik
Registered User
 
Join Date: Jun 2006
Posts: 9
+1 Internets
Quote:
Originally Posted by x1hundredregrets View Post
Is the order I declare shit in this class or struct going to effect how badly my heap and stack get fragmented? Are there any heuristics that I can use to speed up this algorithm. Stuff like that.
On modern processors having poor cache coherency is one of the best ways to kill your programs's efficiency. It isn't so much the number of operations you throw at the processor anymore, but more the cache misses that lead to processor stalls. The problem is, you have to be careful to not try to over think things either. Generally, using cache friendly algorithms combined with a good global memory allocator replacement (like dlmalloc .. in C++ at least) will have you covered.

If after profiling you think reorganizing your data could speed things up, that is when you worry about custom allocators for certain data structures. Trying to optimize too much ahead of time can cause you just as many problems as not thinking about it at all. There is a fine balance, but giving good thought to algorithms used (Big O notation actually comes into effect believe it or not!) and memory layout usually starts you out on the right foot.

Of course, I work as a C++ developer on real-time systems and I have no clue about web development so I'm not able to comment on the differences. I just wanted to back up other comments made.
Drenik is offline   Reply With Quote

 
Uberguilds Network