Linked by Thom Holwerda on Fri 15th Feb 2013 10:40 UTC
General Development "Since I left my job at Amazon I have spent a lot of time reading great source code. Having exhausted the insanely good idSoftware pool, the next thing to read was one of the greatest game of all time: Duke Nukem 3D and the engine powering it named 'Build'. It turned out to be a difficult experience: The engine delivered great value and ranked high in terms of speed, stability and memory consumption but my enthousiasm met a source code controversial in terms of organization, best practices and comments/documentation. This reading session taught me a lot about code legacy and what helps a software live long." Hail to the king, baby.
Thread beginning with comment 552633
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[3]: Code Review
by Bill Shooter of Bul on Fri 15th Feb 2013 15:38 UTC in reply to "RE[2]: Code Review"
Bill Shooter of Bul
Member since:
2006-07-14

Yeah, I'd use structs too. High performance graphics code isn't my specialty so maybe in some scenarios its a bad idea, but I still have a hard time believing that the performance hit outweighs the utility of an organized data structure of some sort. I mean, if its really performance critical, use assembly.

Reply Parent Score: 2

RE[4]: Code Review
by Laurence on Fri 15th Feb 2013 16:43 in reply to "RE[3]: Code Review"
Laurence Member since:
2007-03-26

if its really performance critical, use assembly.

These days compilers are so good at optimising that you're more likely to write better performing code in C than assembly.

Reply Parent Score: 2

RE[5]: Code Review
by Alfman on Fri 15th Feb 2013 17:32 in reply to "RE[4]: Code Review"
Alfman Member since:
2011-01-28

Laurence,

"These days compilers are so good at optimising that you're more likely to write better performing code in C than assembly."

There are still times when I find GCC didn't optimize something as well as it could have, especially when the C code doesn't translate directly to the desired architecture opcode (many bit manipulation, overflow flags, and multi-word-size instructions are completely absent in C). The roundabout algorithm in C will sometimes result in a roundabout assembly optimization.

That said, most of us have thrown in the towel because the business case for hand optimization skills is virtually non-existent. Most businesses are willing to let grossly inefficient code slide by if they can trade off developer costs with better hardware.

Every time this topic comes up someone else points out the the importance of optimizing the algorithm before resorting to assembly, let me preempt this by saying "I agree".

Reply Parent Score: 4

RE[5]: Code Review
by Bill Shooter of Bul on Fri 15th Feb 2013 18:30 in reply to "RE[4]: Code Review"
Bill Shooter of Bul Member since:
2006-07-14

Yeah, its difficult to talk about this in the abstract. If I were in charge of a project, I'd want to see a real performance test between code written with proper data structures and one without to see how much of speed up really exists and how critical that speed up really is to the project. Because often developers write code with prejudiced from past experience that may not be applicable to the current task.

But even today there is a wide range of output from various compilers for different programs. Some do a better job than others for different tasks. If it was really critical ( I agree there aren't many of these situations today), I'd look at the output for different compilers and choose the best output for the task.

Reply Parent Score: 2