
Originally Posted by
Stomme poes
Totally different from DRY in programming.
... and not that DRY is in fact always good practice in programming -- sometimes it's faster to unroll the loop.
Code:
MOV CX,4
:loopBack
MOV AX,DS:[SI]
AND AL,ES:[DI]
OR AL,AH
STOSB
ADD SI,2
LOOP :loopBack
The loop purges the pre-fetch and adds 30 clocks per iteration.
Code:
MOV AX,DS:[SI]
AND AL,ES:[DI]
OR AL,AH
STOSB
ADD SI,2
MOV AX,DS:[SI]
AND AL,ES:[DI]
OR AL,AH
STOSB
ADD SI,2
MOV AX,DS:[SI]
AND AL,ES:[DI]
OR AL,AH
STOSB
ADD SI,2
MOV AX,DS:[SI]
AND AL,ES:[DI]
OR AL,AH
STOSB
ADD SI,2
More bytes, but executes around 40% faster. Sometimes repeating yourself is a good thing.
Though CSS DOES provide for DRY -- if you bother to use it PROPERLY. To borrow from Chris' example:
Code:
html {
font-family:georgia,times,serif;
}
h1, h2, th {
font-family:arial,helvetica,sans-serif;
color:#FFF;
background:#000;
}
Which one's more efficient, uses less code, and is easier to perform mass edits with? Only if you're a total {expletive about one's intelligence omitted} redeclaring the same values over again instead of adding them to like targets would any of this 'variables in CSS' nonsense actually be useful. You want to have multiple elements sharing the same value you can edit in one place -- DECLARE THEM TOGETHER!!! DUH!?!
Though admittedly, I see wasteful CSS with people redeclaring the same things over and over again for no good reason all the time -- goes with that nobody seems to bother realizing not every element needs a DIV around it, class on it... much less that presentational classes are zero improvement over just writing HTML 3.2 without CSS.... which is why we still see dumbass coding like: class="red bigfont centered clearfix" -- Net improvement ZERO.
Bookmarks